1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-06-26 11:47:37 +00:00

Merge branch 'master' of git://github.com/GTAmodding/re3 into erorcun

This commit is contained in:
eray orçunus 2019-06-30 17:55:16 +03:00
commit e650c06acd
98 changed files with 8039 additions and 1217 deletions

View file

@ -150,7 +150,6 @@ typedef interface IAMStats IAMStats;
extern "C"{
#endif
void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * );

View file

@ -24,7 +24,7 @@ extern "C" {
#define VFW_FIRST_CODE 0x200
#define MAX_ERROR_TEXT_LEN 160
#include <VFWMSGS.H> // includes all message definitions
#include <vfwmsgs.h> // includes all message definitions
typedef BOOL (WINAPI* AMGETERRORTEXTPROCA)(HRESULT, char *, DWORD);
typedef BOOL (WINAPI* AMGETERRORTEXTPROCW)(HRESULT, WCHAR *, DWORD);

View file

@ -862,7 +862,6 @@ typedef interface IVPManager IVPManager;
extern "C"{
#endif
void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * );
/* interface __MIDL_itf_strmif_0000 */

View file

@ -1,3 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "BulletTraces.h"
CBulletTrace (&CBulletTraces::aTraces)[16] = *(CBulletTrace(*)[16])*(uintptr*)0x72B1B8;
WRAPPER void CBulletTraces::Init(void) { EAXJMP(0x518DE0); }

View file

@ -6,4 +6,6 @@ class CBulletTraces
{
public:
static CBulletTrace(&aTraces)[16];
static void Init(void);
};

View file

@ -13,7 +13,7 @@
#include "MBlur.h"
#include "Camera.h"
const float DefaultFOV = 80.0f; // actually 70.0f
const float DefaultFOV = 70.0f; // beta: 80.0f
CCamera &TheCamera = *(CCamera*)0x6FACF8;
bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8;
@ -790,7 +790,7 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
float RoadZ = 0.0f;
float RoofZ = 0.0f;
if(CWorld::ProcessVerticalLine(Source, -1000.0f, colpoint, ent, true, false, false, false, false, false, false) &&
if(CWorld::ProcessVerticalLine(Source, -1000.0f, colpoint, ent, true, false, false, false, false, false, nil) &&
ent->IsBuilding()){
FoundRoad = true;
RoadZ = colpoint.point.z;
@ -807,7 +807,7 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
TargetZOffSet = 0.0f;
}
}else{
if(CWorld::ProcessVerticalLine(Source, 1000.0f, colpoint, ent, true, false, false, false, false, false, false) &&
if(CWorld::ProcessVerticalLine(Source, 1000.0f, colpoint, ent, true, false, false, false, false, false, nil) &&
ent->IsBuilding()){
FoundRoof = true;
RoofZ = colpoint.point.z;
@ -1282,4 +1282,6 @@ STARTPATCHES
InjectHook(0x45E3A0, &CCam::Process_FollowPed, PATCH_JUMP);
InjectHook(0x45BE60, &CCam::Process_BehindCar, PATCH_JUMP);
InjectHook(0x45C090, &CCam::Process_Cam_On_A_String, PATCH_JUMP);
InjectHook(0x473250, &CCamera::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -1,5 +1,4 @@
#pragma once
#include "Placeable.h"
class CEntity;
@ -459,6 +458,8 @@ int m_iModeObbeCamIsInForCar;
void RenderMotionBlur(void);
void DrawBordersForWideScreen(void);
void dtor(void) { this->CCamera::~CCamera(); }
};
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error");

View file

@ -1,4 +1,4 @@
#include <Windows.h>
#include <windows.h>
#include "common.h"
#include "patcher.h"
#include "CdStream.h"
@ -53,9 +53,9 @@ CdStreamInitThread(void)
{
for ( int32 i = 0; i < gNumChannels; i++ )
{
gpReadInfo[i].hSemaphore = CreateSemaphore(NULL, 0, 2, NULL);
gpReadInfo[i].hSemaphore = CreateSemaphore(nil, 0, 2, nil);
if ( gpReadInfo[i].hSemaphore == NULL )
if ( gpReadInfo[i].hSemaphore == nil )
{
CDTRACE("failed to create sync semaphore");
ASSERT(0);
@ -68,20 +68,20 @@ CdStreamInitThread(void)
gChannelRequestQ.head = 0;
gChannelRequestQ.tail = 0;
gChannelRequestQ.size = gNumChannels + 1;
ASSERT(gChannelRequestQ.items != NULL );
ASSERT(gChannelRequestQ.items != nil );
gCdStreamSema = CreateSemaphore(NULL, 0, 5, "CdStream");
gCdStreamSema = CreateSemaphore(nil, 0, 5, "CdStream");
if ( gCdStreamSema == NULL )
if ( gCdStreamSema == nil )
{
CDTRACE("failed to create stream semaphore");
ASSERT(0);
return;
}
_gCdStreamThread = CreateThread(NULL, 64*1024/*64KB*/, CdStreamThread, NULL, CREATE_SUSPENDED, &_gCdStreamThreadId);
_gCdStreamThread = CreateThread(nil, 64*1024/*64KB*/, CdStreamThread, nil, CREATE_SUSPENDED, &_gCdStreamThreadId);
if ( _gCdStreamThread == NULL )
if ( _gCdStreamThread == nil )
{
CDTRACE("failed to create streaming thread");
ASSERT(0);
@ -101,7 +101,7 @@ CdStreamInit(int32 numChannels)
DWORD NumberOfFreeClusters;
DWORD TotalNumberOfClusters;
GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters);
GetDiskFreeSpace(nil, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters);
_gdwCdStreamFlags = 0;
@ -118,7 +118,7 @@ CdStreamInit(int32 numChannels)
_gbCdStreamAsync = FALSE;
void *pBuffer = (void *)RwMallocAlign(CDSTREAM_SECTOR_SIZE, BytesPerSector);
ASSERT( pBuffer != NULL );
ASSERT( pBuffer != nil );
SetLastError(0);
@ -127,7 +127,7 @@ CdStreamInit(int32 numChannels)
gNumChannels = numChannels;
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
ASSERT( gpReadInfo != NULL );
ASSERT( gpReadInfo != nil );
CDDEBUG("read info %p", gpReadInfo);
@ -156,15 +156,15 @@ CdStreamInit(int32 numChannels)
CdStreamInitThread();
ASSERT( pBuffer != NULL );
ASSERT( pBuffer != nil );
RwFreeAlign(pBuffer);
}
uint32
GetGTA3ImgSize(void)
{
ASSERT( gImgFiles[0] != NULL );
return (uint32)GetFileSize(gImgFiles[0], NULL);
ASSERT( gImgFiles[0] != nil );
return (uint32)GetFileSize(gImgFiles[0], nil);
}
void
@ -189,17 +189,17 @@ int32
CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
{
ASSERT( channel < gNumChannels );
ASSERT( buffer != NULL );
ASSERT( buffer != nil );
lastPosnRead = size + offset;
ASSERT( _GET_INDEX(offset) < MAX_CDIMAGES );
HANDLE hImage = gImgFiles[_GET_INDEX(offset)];
ASSERT( hImage != NULL );
ASSERT( hImage != nil );
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != NULL );
ASSERT( pChannel != nil );
pChannel->hFile = hImage;
@ -218,7 +218,7 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
AddToQueue(&gChannelRequestQ, channel);
if ( !ReleaseSemaphore(gCdStreamSema, 1, NULL) )
if ( !ReleaseSemaphore(gCdStreamSema, 1, nil) )
printf("Signal Sema Error\n");
return STREAM_SUCCESS;
@ -228,7 +228,7 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
{
ASSERT( channel < gNumChannels );
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != NULL );
ASSERT( pChannel != nil );
pChannel->Overlapped.Offset = _GET_OFFSET(offset) * CDSTREAM_SECTOR_SIZE;
@ -239,11 +239,11 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
return STREAM_SUCCESS;
}
SetFilePointer(hImage, _GET_OFFSET(offset) * CDSTREAM_SECTOR_SIZE, NULL, FILE_BEGIN);
SetFilePointer(hImage, _GET_OFFSET(offset) * CDSTREAM_SECTOR_SIZE, nil, FILE_BEGIN);
DWORD NumberOfBytesRead;
if ( !ReadFile(hImage, buffer, size * CDSTREAM_SECTOR_SIZE, &NumberOfBytesRead, NULL) )
if ( !ReadFile(hImage, buffer, size * CDSTREAM_SECTOR_SIZE, &NumberOfBytesRead, nil) )
return STREAM_NONE;
else
return STREAM_SUCCESS;
@ -254,7 +254,7 @@ CdStreamGetStatus(int32 channel)
{
ASSERT( channel < gNumChannels );
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != NULL );
ASSERT( pChannel != nil );
if ( _gbCdStreamAsync )
{
@ -278,7 +278,7 @@ CdStreamGetStatus(int32 channel)
if ( _gbCdStreamOverlapped )
{
ASSERT( pChannel->hFile != NULL );
ASSERT( pChannel->hFile != nil );
if ( WaitForSingleObjectEx(pChannel->hFile, 0, TRUE) == WAIT_OBJECT_0 )
return STREAM_NONE;
else
@ -299,7 +299,7 @@ CdStreamSync(int32 channel)
{
ASSERT( channel < gNumChannels );
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != NULL );
ASSERT( pChannel != nil );
if ( _gbCdStreamAsync )
{
@ -307,7 +307,7 @@ CdStreamSync(int32 channel)
{
pChannel->bLocked = true;
ASSERT( pChannel->hSemaphore != NULL );
ASSERT( pChannel->hSemaphore != nil );
WaitForSingleObject(pChannel->hSemaphore, INFINITE);
}
@ -321,7 +321,7 @@ CdStreamSync(int32 channel)
if ( _gbCdStreamOverlapped && pChannel->hFile )
{
ASSERT(pChannel->hFile != NULL );
ASSERT(pChannel->hFile != nil );
if ( GetOverlappedResult(pChannel->hFile, &pChannel->Overlapped, &NumberOfBytesTransferred, TRUE) )
return STREAM_NONE;
else
@ -334,8 +334,8 @@ CdStreamSync(int32 channel)
void
AddToQueue(Queue *queue, int32 item)
{
ASSERT( queue != NULL );
ASSERT( queue->items != NULL );
ASSERT( queue != nil );
ASSERT( queue->items != nil );
queue->items[queue->tail] = item;
queue->tail = (queue->tail + 1) % queue->size;
@ -347,18 +347,18 @@ AddToQueue(Queue *queue, int32 item)
int32
GetFirstInQueue(Queue *queue)
{
ASSERT( queue != NULL );
ASSERT( queue != nil );
if ( queue->head == queue->tail )
return -1;
ASSERT( queue->items != NULL );
ASSERT( queue->items != nil );
return queue->items[queue->head];
}
void
RemoveFirstInQueue(Queue *queue)
{
ASSERT( queue != NULL );
ASSERT( queue != nil );
if ( queue->head == queue->tail )
{
debug("Queue is empty\n");
@ -381,7 +381,7 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
ASSERT( channel < gNumChannels );
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != NULL );
ASSERT( pChannel != nil );
pChannel->bInUse = true;
@ -391,8 +391,8 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
{
pChannel->Overlapped.Offset = pChannel->nSectorOffset * CDSTREAM_SECTOR_SIZE;
ASSERT(pChannel->hFile != NULL );
ASSERT(pChannel->pBuffer != NULL );
ASSERT(pChannel->hFile != nil );
ASSERT(pChannel->pBuffer != nil );
DWORD NumberOfBytesTransferred;
@ -416,10 +416,10 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
}
else
{
ASSERT(pChannel->hFile != NULL );
ASSERT(pChannel->pBuffer != NULL );
ASSERT(pChannel->hFile != nil );
ASSERT(pChannel->pBuffer != nil );
SetFilePointer(pChannel->hFile, pChannel->nSectorOffset * CDSTREAM_SECTOR_SIZE, NULL, FILE_BEGIN);
SetFilePointer(pChannel->hFile, pChannel->nSectorOffset * CDSTREAM_SECTOR_SIZE, nil, FILE_BEGIN);
DWORD NumberOfBytesRead;
if ( ReadFile(pChannel->hFile,
@ -439,7 +439,7 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
if ( pChannel->bLocked )
{
ASSERT( pChannel->hSemaphore != NULL );
ASSERT( pChannel->hSemaphore != nil );
ReleaseSemaphore(pChannel->hSemaphore, 1, NULL);
}
@ -450,7 +450,7 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
bool
CdStreamAddImage(char const *path)
{
ASSERT(path != NULL);
ASSERT(path != nil);
ASSERT(gNumImages < MAX_CDIMAGES);
SetLastError(0);
@ -458,12 +458,12 @@ CdStreamAddImage(char const *path)
gImgFiles[gNumImages] = CreateFile(path,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
nil,
OPEN_EXISTING,
_gdwCdStreamFlags | FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_READONLY,
NULL);
nil);
ASSERT( gImgFiles[gNumImages] != NULL );
ASSERT( gImgFiles[gNumImages] != nil );
if ( gImgFiles[gNumImages] == NULL )
return false;
@ -478,10 +478,10 @@ char *
CdStreamGetImageName(int32 cd)
{
ASSERT(cd < MAX_CDIMAGES);
if ( gImgFiles[cd] != NULL )
if ( gImgFiles[cd] != nil )
return gCdImageNames[cd];
return NULL;
return nil;
}
void
@ -495,7 +495,7 @@ CdStreamRemoveImages(void)
SetLastError(0);
CloseHandle(gImgFiles[i]);
gImgFiles[i] = NULL;
gImgFiles[i] = nil;
}
gNumImages = 0;

View file

@ -1736,8 +1736,6 @@ CColModel::operator=(const CColModel &other)
int i;
int numVerts;
assert(0);
boundingSphere = other.boundingSphere;
boundingBox = other.boundingBox;

View file

@ -1 +1,21 @@
#include "DamageManager.h"
#include "common.h"
#include "patcher.h"
#include "DamageManager.h"
#if 0
WRAPPER void CDamageManager::SetDoorStatus(int door, unsigned int status) { EAXJMP(0x545920); }
#else
void CDamageManager::SetDoorStatus(int door, unsigned int status)
{
m_bDoorStatus[door] = status;
}
#endif
#if 0
WRAPPER unsigned int CDamageManager::GetDoorStatus(int door) { EAXJMP(0x545930); }
#else
unsigned int CDamageManager::GetDoorStatus(int door)
{
return m_bDoorStatus[door];
}
#endif

View file

@ -5,6 +5,16 @@
class CDamageManager
{
public:
enum {
CAR_DOOR_BONNET = 0,
CAR_DOOR_BUMPER,
CAR_DOOR_LF,
CAR_DOOR_RF,
CAR_DOOR_LR,
CAR_DOOR_RR
};
float field_0;
char m_bEngineStatus;
char m_bWheelStatus[4];
@ -15,4 +25,7 @@ public:
char field_25;
char field_26;
char field_27;
void SetDoorStatus(int, unsigned int);
unsigned int GetDoorStatus(int);
};

7
src/EmergencyPed.cpp Normal file
View file

@ -0,0 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "EmergencyPed.h"
STARTPATCHES
InjectHook(0x4C2EF0, &CEmergencyPed::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -38,7 +38,7 @@ void
LoadingScreenLoadingFile(const char *filename)
{
sprintf(gString, "Loading %s", GetFilename(filename));
LoadingScreen("Loading the Game", gString, 0);
LoadingScreen("Loading the Game", gString, nil);
}
void
@ -144,7 +144,7 @@ CFileLoader::LoadLine(int fd)
int i;
char *line;
if(CFileMgr::ReadLine(fd, ms_line, 256) == nil)
if(CFileMgr::ReadLine(fd, ms_line, 256) == false)
return nil;
for(i = 0; ms_line[i] != '\0'; i++)
if(ms_line[i] < ' ' || ms_line[i] == ',')
@ -311,7 +311,7 @@ CFileLoader::FindRelatedModelInfoCB(RpAtomic *atomic, void *data)
nodename = GetFrameNodeName(RpClumpGetFrame(atomic));
GetNameAndLOD(nodename, name, &n);
mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(name, 0);
mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(name, nil);
if(mi){
assert(mi->IsSimple());
mi->SetAtomic(n, atomic);
@ -360,7 +360,7 @@ CFileLoader::LoadClumpFile(const char *filename)
if(clump){
nodename = GetFrameNodeName(RpClumpGetFrame(clump));
GetNameAndLOD(nodename, name, &n);
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, 0);
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil);
assert(mi->IsClump());
if(mi)
mi->SetClump(clump);
@ -457,7 +457,7 @@ CFileLoader::SetRelatedModelInfoCB(RpAtomic *atomic, void *data)
RpClumpRemoveAtomic(clump, atomic);
RpAtomicSetFrame(atomic, RwFrameCreate());
CVisibilityPlugins::SetAtomicModelInfo(atomic, gpRelatedModelInfo);
CVisibilityPlugins::SetAtomicRenderCallback(atomic, 0);
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
return atomic;
}

5
src/Fire.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Fire.h"
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }

23
src/Fire.h Normal file
View file

@ -0,0 +1,23 @@
#pragma once
#include "common.h"
#include "Entity.h"
class CFire
{
char m_bIsOngoing;
char m_bExists;
char m_bPropogationFlag;
char m_bAudioSet;
CVector m_vecPos;
CEntity *m_pEntity;
CEntity *m_pSource;
int m_nExtinguishTime;
int m_nStartTime;
int field_20;
int field_24;
int field_28;
float field_2C;
public:
void Extinguish(void);
};

7
src/MloInstance.cpp Normal file
View file

@ -0,0 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "MloInstance.h"
STARTPATCHES
InjectHook(0x50BE90, &CMloInstance::dtor, PATCH_JUMP);
ENDPATCHES

9
src/MloInstance.h Normal file
View file

@ -0,0 +1,9 @@
#pragma once
#include "Placeable.h"
class CMloInstance : CPlaceable
{
public:
void dtor() { this->CMloInstance::~CMloInstance(); }
};

View file

@ -187,10 +187,10 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
{
CMouseControllerState state;
if ( PSGLOBAL(mouse) == NULL )
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
if ( PSGLOBAL(mouse) != NULL )
if ( PSGLOBAL(mouse) != nil )
{
DIDEVCAPS devCaps;
devCaps.dwSize = sizeof(DIDEVCAPS);
@ -228,12 +228,12 @@ void CPad::UpdateMouse()
{
if ( IsForegroundApp() )
{
if ( PSGLOBAL(mouse) == NULL )
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
DIMOUSESTATE2 state;
if ( PSGLOBAL(mouse) != NULL && SUCCEEDED(_InputGetMouseState(&state)) )
if ( PSGLOBAL(mouse) != nil && SUCCEEDED(_InputGetMouseState(&state)) )
{
int32 signX = 1;
int32 signy = 1;
@ -386,7 +386,7 @@ void CPad::StartShake_Train(float fX, float fY)
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
return;
if (FindPlayerVehicle() != NULL && FindPlayerVehicle()->IsTrain() )
if (FindPlayerVehicle() != nil && FindPlayerVehicle()->IsTrain() )
return;
float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, 0.0f) ).Magnitude2D();
@ -1822,7 +1822,7 @@ char *CPad::EditString(char *pStr, int32 nSize)
// extenter/up/down
if ( GetPad(0)->GetEnterJustDown() || GetPad(0)->GetUpJustDown() || GetPad(0)->GetDownJustDown() )
return NULL;
return nil;
return pStr;
}

View file

@ -4,7 +4,6 @@
WRAPPER void CParticleObject::AddObject(uint16, const CVector &pos, bool remove) { EAXJMP(0x4BC4D0); }
// Converted from static void __cdecl CParticleObject::Initialise() 0x42C760
void CParticleObject::Initialise()
{
@ -15,4 +14,8 @@ void CParticleObject::Initialise()
void CParticleObject::UpdateAll()
{
((void (__cdecl *)())0x4BCA30)();
}
}
STARTPATCHES
InjectHook(0x4BC420, &CParticleObject::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -1,5 +1,7 @@
#pragma once
#include "Placeable.h"
enum eParticleObjectType
{
POBJECT_PAVEMENT_STEAM,
@ -24,10 +26,12 @@ enum eParticleObjectType
POBJECT_CATALINAS_SHOTGUNFLASH,
};
class CParticleObject
class CParticleObject : CPlaceable
{
public:
static void AddObject(uint16, const CVector &pos, bool remove);
static void Initialise();
static void UpdateAll();
void dtor() { this->CParticleObject::~CParticleObject(); }
};

View file

@ -2,10 +2,10 @@
class CPlaceable
{
// disable allocation
static void *operator new(size_t) { assert(0); return nil; }
static void operator delete(void*, size_t) { assert(0); }
public:
// disable allocation
static void *operator new(size_t) = delete;
CMatrix m_matrix;
CPlaceable(void);

View file

@ -43,7 +43,7 @@ CSprite2d *CRadar::TonySprite = (CSprite2d*)0x885B58;
CSprite2d *CRadar::WeaponSprite = (CSprite2d*)0x941534;
CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
NULL,
nil,
AsukaSprite,
BombSprite,
CatSprite,

View file

@ -1,7 +1,7 @@
#define WITHD3D
#include "common.h"
#include "patcher.h"
#include "TimeCycle.h"
#include "Timecycle.h"
#include "skeleton.h"
void *
@ -9,11 +9,11 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align)
{
void *mem = (void *)malloc(size + align);
ASSERT(mem != NULL);
ASSERT(mem != nil);
void *addr = (void *)((((RwUInt32)mem) + align) & ~(align - 1));
ASSERT(addr != NULL);
ASSERT(addr != nil);
*(((void **)addr) - 1) = mem;
@ -23,11 +23,11 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align)
void
RwFreeAlign(void *mem)
{
ASSERT(mem != NULL);
ASSERT(mem != nil);
void *addr = *(((void **)mem) - 1);
ASSERT(addr != NULL);
ASSERT(addr != nil);
free(addr);
}
@ -283,7 +283,7 @@ CameraDestroy(RwCamera *camera)
RwRasterDestroy(raster);
if ((tmpRaster != NULL) && (tmpRaster != raster))
if ((tmpRaster != nil) && (tmpRaster != raster))
{
RwRasterDestroy(tmpRaster);
}
@ -296,7 +296,7 @@ CameraDestroy(RwCamera *camera)
RwRasterDestroy(raster);
if ((tmpRaster != NULL) && (tmpRaster != raster))
if ((tmpRaster != nil) && (tmpRaster != raster))
{
RwRasterDestroy(tmpRaster);
}
@ -344,7 +344,7 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
/* if we're here then an error must have occurred so clean up */
CameraDestroy(camera);
return (NULL);
return (nil);
}
STARTPATCHES

View file

@ -54,7 +54,7 @@ _rpMatFXD3D8AtomicMatFXDefaultRender(RxD3D8InstanceData *inst, int flags, RwText
if(flags & (rpGEOMETRYTEXTURED|rpGEOMETRYTEXTURED2) && texture)
RwD3D8SetTexture(texture, 0);
else
RwD3D8SetTexture(NULL, 0);
RwD3D8SetTexture(nil, 0);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(inst->vertexAlpha || inst->material->color.alpha != 0xFF));
RwD3D8SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, inst->vertexAlpha != 0);
RwD3D8SetPixelShader(0);

View file

@ -1,5 +1,7 @@
#pragma once
#include "Game.h"
enum {
STREAM_OFFSET_MODEL = 0,
STREAM_OFFSET_TXD = STREAM_OFFSET_MODEL+MODELINFOSIZE,

View file

@ -1,4 +1,4 @@
#include <Windows.h>
#include <windows.h>
#include "common.h"
#include "patcher.h"
#include "DMAudio.h"

View file

@ -164,7 +164,7 @@ CTxdStore::StartLoadTxd(int slot, RwStream *stream)
return def->texDict != nil;
}else{
printf("Failed to load TXD\n");
return nil;
return false;
}
}

View file

@ -67,8 +67,8 @@ public:
static bool &bForceProcessControl;
static bool &bProcessCutsceneOnly;
static void Remove(CEntity *entity);
static void Add(CEntity *entity);
static void Remove(CEntity *ent);
static CSector *GetSector(int x, int y) { return &ms_aSectors[y][x]; }
static CPtrList &GetBigBuildingList(eLevelName i) { return ms_bigBuildingsList[i]; }

View file

@ -9,7 +9,7 @@ CAnimBlendHierarchy::CAnimBlendHierarchy(void)
numSequences = 0;
compressed = 0;
totalLength = 0.0f;
linkPtr = 0;
linkPtr = nil;
}
void

View file

@ -366,7 +366,7 @@ RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta)
updateData.foobar = 1;
}
}
updateData.nodes[i] = 0;
updateData.nodes[i] = nil;
clumpData->ForAllFrames(FrameUpdateCallBack, &updateData);

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,296 @@
#pragma once
class cAudioManager {
#include "AudioSamples.h"
#include "DMAudio.h"
#include "common.h"
class tActiveSample
{
public:
void PlayerJustLeftCar(void);
void Service();
int m_nEntityIndex;
int field_4;
int m_nSampleIndex;
char m_bBankIndex;
char m_bIsDistant;
char field_14;
char field_15;
int field_16;
int m_nFrequency;
uint8 m_bVolume;
char field_25;
char field_26;
char field_27;
float m_fDistance;
int m_nLoopCount;
int m_nLoopStart;
int m_nLoopEnd;
uint8 m_bEmittingVolume;
char field_45;
char field_46;
char field_47;
float field_48;
float m_fSoundIntensity;
char field_56;
char field_57;
char field_58;
char field_59;
CVector m_vecPos;
char m_bReverbFlag;
char m_bLoopsRemaining;
char m_bRequireReflection;
uint8 m_bOffset;
int field_76;
char m_bIsProcessed;
char m_bLoopEnded;
char field_82;
char field_83;
int field_84;
char field_88;
char field_89;
char field_90;
char field_91;
};
extern cAudioManager &AudioManager;
static_assert(sizeof(tActiveSample) == 0x5c, "tActiveSample: error");
enum eAudioType : int32 {
AUDIOTYPE_PHYSICAL = 0,
AUDIOTYPE_EXPLOSION = 1,
AUDIOTYPE_FIRE = 2,
AUDIOTYPE_WEATHER = 3,
AUDIOTYPE_CRANE = 4,
AUDIOTYPE_ONE_SHOT = 5,
AUDIOTYPE_BRIDGE = 6,
AUDIOTYPE_COLLISION = 7,
AUDIOTYPE_FRONTEND = 8,
AUDIOTYPE_PROJECTILE = 9,
AUDIOTYPE_GARAGE = 10,
AUDIOTYPE_HYDRANT = 11,
AUDIOTYPE_WATER_CANNON = 12,
AUDIOTYPE_D = 13,
TOTAL_AUDIO_TYPES = 14,
};
class tAudioEntity
{
public:
eAudioType m_nType;
void *m_pEntity;
char m_bIsUsed;
char m_bStatus;
int16 m_awAudioEvent[4];
char gap_18[2];
float m_afVolume[4];
char field_24;
char field_25[3];
};
static_assert(sizeof(tAudioEntity) == 0x28, "tAudioEntity: error");
class tPedComment
{
public:
int m_nSampleIndex;
int field_4;
CVector m_vecPos;
float m_fDistance;
char m_bVolume;
char field_25;
char gap_26[2];
};
static_assert(sizeof(tPedComment) == 0x1c, "tPedComment: error");
class cPedComments
{
public:
tPedComment m_asPedComments[40];
char field_1120[40];
char field_1160[2];
char field_1162;
char gap_1163[1];
};
static_assert(sizeof(cPedComments) == 0x48c, "cPedComments: error");
class CEntity;
class cAudioCollision
{
public:
CEntity *m_pEntity1;
CEntity *m_pEntity2;
char m_bSurface1;
char m_bSurface2;
char field_10;
char field_11;
float m_fIntensity1;
float m_fIntensity2;
CVector m_vecPosition;
float m_fDistance;
int m_nBaseVolume;
};
static_assert(sizeof(cAudioCollision) == 0x28, "cAudioCollision: error");
class cAudioCollisionManager
{
public:
cAudioCollision m_asCollisions1[10];
cAudioCollision m_asCollisions2[10];
char m_bIndicesTable[10];
char m_bCollisionsInQueue;
char gap_811;
cAudioCollision m_sQueue;
};
static_assert(sizeof(cAudioCollisionManager) == 0x354,
"cAudioCollisionManager: error");
class cMissionAudio
{
public:
CVector m_vecPos;
char field_12;
char gap_13[3];
int m_nSampleIndex;
char m_bLoadingStatus;
char m_bPlayStatus;
char field_22;
char field_23;
int field_24;
char m_bIsPlayed;
char field_29;
char field_30;
char field_31;
};
static_assert(sizeof(cMissionAudio) == 0x20, "cMissionAudio: error");
class cAudioManager
{
public:
bool m_bIsInitialised;
char field_1;
char field_2;
char m_bActiveSamples;
char field_4;
char m_bDynamicAcousticModelingStatus;
char field_6;
char field_7;
float field_8;
bool m_bTimerJustReset;
char field_13;
char field_14;
char field_15;
int m_nTimer;
tActiveSample m_sQueueSample;
char m_bActiveSampleQueue;
char gap_109[3];
tActiveSample m_asSamples[54];
char m_abSampleQueueIndexTable[54];
char m_bSampleRequestQueuesStatus[2];
tActiveSample m_asActiveSamples[27];
tAudioEntity m_asAudioEntities[200];
int m_anAudioEntityIndices[200];
int m_nAudioEntitiesTotal;
CVector m_avecReflectionsPos[5];
float m_afReflectionsDistances[5];
int m_anScriptObjectEntityIndices[40];
int m_nScriptObjectEntityTotal;
cPedComments m_sPedComments;
int m_nFireAudioEntity;
int m_nWaterCannonEntity;
int m_nPoliceChannelEntity;
char gap45B8[444];
int m_nFrontEndEntity;
int m_nCollisionEntity;
cAudioCollisionManager m_sCollisionManager;
int m_nProjectileEntity;
int m_nBridgeEntity;
cMissionAudio m_sMissionAudio;
int m_anRandomTable[5];
char field_19192;
char m_bUserPause;
char m_bPreviousUserPause;
char field_19195;
int m_nTimeOfRecentCrime;
void PlayerJustLeftCar(void);
void Service();
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample,
uint32 maxOffset);
uint32 GetPlayerTalkSfx(int16 sound);
uint32 GetCopTalkSfx(int16 sound);
uint32 GetSwatTalkSfx(int16 sound);
uint32 GetFBITalkSfx(int16 sound);
uint32 GetArmyTalkSfx(int16 sound);
uint32 GetMedicTalkSfx(int16 sound);
uint32 GetFiremanTalkSfx(int16 sound);
uint32 GetNormalMaleTalkSfx(int16 sound);
uint32 GetTaxiDriverTalkSfx(int16 sound);
uint32 GetPimpTalkSfx(int16 sound);
uint32 GetMafiaTalkSfx(int16 sound);
uint32 GetTriadTalkSfx(int16 sound);
uint32 GetDiabloTalkSfx(int16 sound);
uint32 GetYakuzaTalkSfx(int16 sound);
uint32 GetYardieTalkSfx(int16 sound);
uint32 GetColumbianTalkSfx(int16 sound);
uint32 GetHoodTalkSfx(int16 sound);
uint32 GetBlackCriminalTalkSfx(int16 sound);
uint32 GetWhiteCriminalTalkSfx(int16 sound);
int32 GetSpecialCharacterTalkSfx(int32, int32);
uint32 GetMaleNo2TalkSfx(int16 sound);
uint32 GetBlackProjectMaleTalkSfx(int16 sound, int32 model);
uint32 GetWhiteFatMaleTalkSfx(int16 sound);
uint32 GetBlackFatMaleTalkSfx(int16 sound);
uint32 GetBlackCasualFemaleTalkSfx(int16 sound);
uint32 GetWhiteCasualFemaleTalkSfx(int16 sound);
uint32 GetFemaleNo3TalkSfx(int16 sound);
uint32 GetBlackFatFemaleTalkSfx(int16 sound);
uint32 GetWhiteFatFemaleTalkSfx(int16 sound);
uint32 GetBlackFemaleProstituteTalkSfx(int16 sound);
uint32 GetWhiteFemaleProstituteTalkSfx(int16 sound);
uint32 GetBlackProjectFemaleOldTalkSfx(int16 sound);
uint32 GetBlackProjectFemaleYoungTalkSfx(int16 sound);
uint32 GetChinatownMaleOldTalkSfx(int16 sound);
uint32 GetChinatownMaleYoungTalkSfx(int16 sound);
uint32 GetChinatownFemaleOldTalkSfx(int16 sound);
uint32 GetChinatownFemaleYoungTalkSfx(int16 sound);
uint32 GetLittleItalyMaleTalkSfx(int16 sound);
uint32 GetLittleItalyFemaleOldTalkSfx(int16 sound);
uint32 GetLittleItalyFemaleYoungTalkSfx(int16 sound);
uint32 GetWhiteDockerMaleTalkSfx(int16 sound);
uint32 GetBlackDockerMaleTalkSfx(int16 sound);
uint32 GetScumMaleTalkSfx(int16 sound);
uint32 GetScumFemaleTalkSfx(int16 sound);
uint32 GetWhiteWorkerMaleTalkSfx(int16 sound);
uint32 GetBlackWorkerMaleTalkSfx(int16 sound);
uint32 GetBusinessMaleYoungTalkSfx(int16 sound, int32 model);
uint32 GetBusinessMaleOldTalkSfx(int16 sound);
uint32 GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model);
uint32 GetBlackBusinessFemaleTalkSfx(int16 sound);
uint32 GetSupermodelMaleTalkSfx(int16 sound);
uint32 GetSupermodelFemaleTalkSfx(int16 sound);
uint32 GetStewardMaleTalkSfx(int16 sound);
uint32 GetStewardFemaleTalkSfx(int16 sound);
uint32 GetFanMaleTalkSfx(int16 sound, int32 model);
uint32 GetFanFemaleTalkSfx(int16 sound);
uint32 GetHospitalMaleTalkSfx(int16 sound);
uint32 GetHospitalFemaleTalkSfx(int16 sound);
uint32 GetWhiteConstructionWorkerTalkSfx(int16 sound);
uint32 GetBlackConstructionWorkerTalkSfx(int16 sound);
uint32 GetShopperFemaleTalkSfx(int16 sound, int32 model);
uint32 GetStudentMaleTalkSfx(int16 sound);
uint32 GetStudentFemaleTalkSfx(int16 sound);
uint32 GetCasualMaleOldTalkSfx(int16 sound);
uint32 GetGenericMaleTalkSfx(int16 sound);
uint32 GetGenericFemaleTalkSfx(int16 sound);
};
static_assert(sizeof(cAudioManager) == 0x4B14, "cAudioManager: error");
extern cAudioManager &AudioManager;
extern cAudioManager &Players;

3040
src/audio/AudioSamples.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -27,3 +27,4 @@ WRAPPER void cDMAudio::SetMusicFadeVol(uint8) { EAXJMP(0x57C920); }
WRAPPER int32 cDMAudio::CreateEntity(int, void*) { EAXJMP(0x57C7C0); }
WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810); }
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); }

View file

@ -1,6 +1,6 @@
#pragma once
enum eSound
enum eSound : int16
{
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
@ -101,7 +101,7 @@ enum eSound
SOUND_PAGER = 96,
SOUND_PED_DEATH = 97,
SOUND_PED_DAMAGE = 98,
SOUND_PED_63 = 99,
SOUND_PED_HIT = 99,
SOUND_PED_LAND = 100,
SOUND_PED_BULLET_HIT = 101,
SOUND_PED_BOMBER = 102,
@ -196,6 +196,6 @@ public:
void SetEntityStatus(int32 id, uint8 enable);
void SetRadioInCar(int32);
uint8 IsMP3RadioChannelAvailable();
void DestroyEntity(int32);
};
extern cDMAudio &DMAudio;

View file

@ -55,7 +55,7 @@ void cMusicManager::DisplayRadioStationName()
if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() && !CReplay::IsPlayingBack()) {
if (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
pCurrentStation = nullptr;
pCurrentStation = nil;
if (cSampleManager.IsMP3RadioChannelAvailable()) {
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
@ -103,7 +103,7 @@ void cMusicManager::DisplayRadioStationName()
}
}
wchar *string = nullptr;
wchar *string = nil;
switch (pRetune) {
case HEAD_RADIO:

View file

@ -14,7 +14,7 @@
#include <new>
#ifdef WITHD3D
#include <Windows.h>
#include <windows.h>
#include <d3d8types.h>
#endif
@ -43,7 +43,7 @@ typedef int64_t int64;
// hardcode ucs-2
typedef uint16_t wchar;
#define nil NULL
#define nil nullptr
#include "config.h"
@ -53,7 +53,7 @@ typedef uint16_t wchar;
extern void **rwengine;
#define RwEngineInstance (*rwengine)
#include "skel\skeleton.h"
#include "skeleton.h"
#include "Draw.h"
/*
@ -164,3 +164,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define PERCENT(x, p) ((float(x) * (float(p) / 100.0f)))
#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))

View file

@ -3,6 +3,8 @@
#include "CarCtrl.h"
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
int &CCarCtrl::NumAmbulancesOnDuty = *(int*)0x885BB0;
int &CCarCtrl::NumFiretrucksOnDuty = *(int*)0x9411F0;
bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A;
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }

View file

@ -11,5 +11,7 @@ public:
static int32 ChooseCarModel(int32 vehclass);
static int32 &NumLawEnforcerCars;
static int32 &NumAmbulancesOnDuty;
static int32 &NumFiretrucksOnDuty;
static bool &bCarsGeneratedAroundCamera;
};

View file

@ -19,14 +19,14 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
pos->z + 1.0f
);
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, false))
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
foundColZ = foundCol.point.z;
// Adjust coords and do a second test
vec.x += 0.1f;
vec.y += 0.1f;
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, false))
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
foundColZ2 = foundCol.point.z;
zForPed = max(foundColZ, foundColZ2);

View file

@ -1,11 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "AnimBlendAssociation.h"
#include "Boat.h"
#include "BulletTraces.h"
#include "CarCtrl.h"
#include "CivilianPed.h"
#include "Clock.h"
#include "DMAudio.h"
#include "Draw.h"
#include "Heli.h"
#include "math/Matrix.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
@ -13,6 +16,7 @@
#include "Pad.h"
#include "PhoneInfo.h"
#include "Pickups.h"
#include "Plane.h"
#include "Pools.h"
#include "Population.h"
#include "Replay.h"
@ -22,6 +26,7 @@
#include "render/Skidmarks.h"
#include "Streaming.h"
#include "Timer.h"
#include "Train.h"
#include "Weather.h"
#include "Zones.h"
#include "Font.h"
@ -42,13 +47,13 @@ uint8 *&CReplay::pBuf8 = *(uint8**)0x8E2C54;
CEntryInfoNode *&CReplay::pBuf9 = *(CEntryInfoNode**)0x8E2C58;
uint8 *&CReplay::pBuf10 = *(uint8**)0x8F2C28;
CDummyPed *&CReplay::pBuf11 = *(CDummyPed**)0x8F2C2C;
CBlip *&CReplay::pRadarBlips = *(CBlip**)0x8F29F8;
CCamera *&CReplay::pStoredCam = *(CCamera**)0x8F2C34;
CSector *&CReplay::pWorld1 = *(CSector**)0x8E29C4;
uint8 *&CReplay::pRadarBlips = *(uint8**)0x8F29F8;
uint8 *&CReplay::pStoredCam = *(uint8**)0x8F2C34;
uint8 *&CReplay::pWorld1 = *(uint8**)0x8E29C4;
CReference *&CReplay::pEmptyReferences = *(CReference**)0x8F256C;
CStoredDetailedAnimationState *&CReplay::pPedAnims = *(CStoredDetailedAnimationState**)0x8F6260;
CPickup *&CReplay::pPickups = *(CPickup**)0x8F1A48;
CReference *&CReplay::pReferences = *(CReference**)0x880FAC;
uint8 *&CReplay::pPickups = *(uint8**)0x8F1A48;
uint8 *&CReplay::pReferences = *(uint8**)0x880FAC;
uint8(&CReplay::BufferStatus)[8] = *(uint8(*)[8])*(uintptr*)0x8804D8;
uint8(&CReplay::Buffers)[8][100000] = *(uint8(*)[8][100000])*(uintptr*)0x779958;
bool &CReplay::bPlayingBackFromFile = *(bool*)0x95CD58;
@ -82,11 +87,13 @@ bool &CReplay::bAllowLookAroundCam = *(bool*)0x95CDCD;
float &CReplay::LoadSceneX = *(float*)0x880F9C;
float &CReplay::LoadSceneY = *(float*)0x880F98;
float &CReplay::LoadSceneZ = *(float*)0x880F94;
float &CReplay::CameraFocusX = *(float*)0x942F5C;
float &CReplay::CameraFocusY = *(float*)0x942F74;
float &CReplay::CameraFocusZ = *(float*)0x942F58;
bool &CReplay::bPlayerInRCBuggy = *(bool*)0x95CDC3;
#if 1
static void(*(&CBArray)[30])(CAnimBlendAssociation*, void*) = *(void(*(*)[30])(CAnimBlendAssociation*, void*))*(uintptr*)0x61052C;
#else
static void(*CBArray[])(CAnimBlendAssociation*, void*) =
static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) =
{
nil, &CPed::PedGetupCB, &CPed::PedStaggerCB, &CPed::PedEvadeCB, &CPed::FinishDieAnimCB,
&CPed::FinishedWaitCB, &CPed::FinishLaunchCB, &CPed::FinishHitHeadCB, &CPed::PedAnimGetInCB, &CPed::PedAnimDoorOpenCB,
@ -95,7 +102,6 @@ static void(*CBArray[])(CAnimBlendAssociation*, void*) =
&CPed::FinishFightMoveCB, &PhonePutDownCB, &PhonePickUpCB, &CPed::PedAnimDoorCloseRollingCB, &CPed::FinishJumpCB,
&CPed::PedLandCB, &FinishFuckUCB, &CPed::RestoreHeadingRateCB, &CPed::PedSetQuickDraggedOutCarPositionCB, &CPed::PedSetDraggedOutCarPositionCB
};
#endif
#if 0
WRAPPER uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) { EAXJMP(0x584E70); }
@ -106,13 +112,17 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
if (CBArray[i] == f)
return i;
}
for (int i = 0; i < sizeof(CBArray_RE3) / sizeof(*CBArray_RE3); i++) {
if (CBArray_RE3[i] == f)
return i;
}
return 0;
}
#endif
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
{
return CBArray[id];
return CBArray_RE3[id];
}
WRAPPER static void ApplyPanelDamageToCar(uint32, CAutomobile*, bool) { EAXJMP(0x584EA0); }
@ -165,8 +175,6 @@ void CReplay::Init(void)
bDoLoadSceneWhenDone = false;
}
WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); }
void CReplay::DisableReplays(void)
{
bReplayEnabled = false;
@ -373,7 +381,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
state->aFunctionCallbackID[i] = 0;
}
}else{
state->aAnimId[i] = 173; /* TODO: enum */
state->aAnimId[i] = NUM_ANIMS;
state->aCurTime[i] = 0;
state->aSpeed[i] = 85;
state->aFunctionCallbackID[i] = 0;
@ -397,7 +405,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
}
}
else {
state->aAnimId2[i] = 173; /* TODO: enum */
state->aAnimId2[i] = NUM_ANIMS;
state->aCurTime2[i] = 0;
state->aSpeed2[i] = 85;
state->aFunctionCallbackID2[i] = 0;
@ -406,10 +414,165 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
}
}
#endif
#if 0
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
#else
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
{
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
if (!ped){
debug("Replay:Ped wasn't there\n");
buffer->m_nOffset += sizeof(tPedUpdatePacket);
return;
}
ped->m_fRotationCur = pp->heading * M_PI / 128.0f;
ped->m_fRotationDest = pp->heading * M_PI / 128.0f;
CMatrix ped_matrix;
pp->matrix.DecompressIntoFullMatrix(ped_matrix);
ped->GetMatrix() = ped->GetMatrix() * CMatrix(1.0f - interpolation);
*ped->GetMatrix().GetPosition() *= (1.0f - interpolation);
ped->GetMatrix() += CMatrix(interpolation) * ped_matrix;
if (pp->vehicle_index) {
ped->m_pMyVehicle = CPools::GetVehiclePool()->GetSlot(pp->vehicle_index - 1);
ped->bInVehicle = pp->vehicle_index;
}
else {
ped->m_pMyVehicle = nil;
ped->bInVehicle = false;
}
if (pp->assoc_group_id != ped->m_animGroup) {
ped->m_animGroup = (AssocGroupId)pp->assoc_group_id;
if (ped == FindPlayerPed())
((CPlayerPed*)ped)->ReApplyMoveAnims();
}
RetrievePedAnimation(ped, &pp->anim_state);
ped->RemoveWeaponModel(-1);
if (pp->weapon_model != (uint8)-1)
ped->AddWeaponModel(pp->weapon_model);
CWorld::Remove(ped);
CWorld::Add(ped);
buffer->m_nOffset += sizeof(tPedUpdatePacket);
}
#endif
#if 0
WRAPPER void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x5942A0); }
#else
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
{
CAnimBlendAssociation* anim1 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject,
(state->animId > 3) ? ASSOCGRP_STD : ped->m_animGroup,
(AnimationId)state->animId, 100.0f);
anim1->SetCurrentTime(state->time * 4.0f / 255.0f);
anim1->speed = state->speed * 3.0f / 255.0f;
anim1->SetBlend(1.0f, 1.0f);
anim1->callbackType = CAnimBlendAssociation::CB_NONE;
if (state->blendAmount && state->secAnimId){
float time = state->secTime * 4.0f / 255.0f;
float speed = state->secSpeed * 3.0f / 255.0f;
float blend = state->blendAmount * 2.0f / 255.0f;
CAnimBlendAssociation* anim2 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject,
(state->secAnimId > 3) ? ASSOCGRP_STD : ped->m_animGroup,
(AnimationId)state->secAnimId, 100.0f);
anim2->SetCurrentTime(time);
anim2->speed = speed;
anim2->SetBlend(blend, 1.0f);
anim2->callbackType = CAnimBlendAssociation::CB_NONE;
}
RpAnimBlendClumpRemoveAssociations((RpClump*)ped->m_rwObject, 0x10);
if (state->partAnimId){
float time = state->partAnimTime * 4.0f / 255.0f;
float speed = state->partAnimSpeed * 3.0f / 255.0f;
float blend = state->partBlendAmount * 2.0f / 255.0f;
if (blend > 0.0f && state->partAnimId != ANIM_IDLE_STANCE){
CAnimBlendAssociation* anim3 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject, ASSOCGRP_STD, (AnimationId)state->partAnimId, 1000.0f);
anim3->SetCurrentTime(time);
anim3->speed = speed;
anim3->SetBlend(blend, 0.0f);
}
}
}
#endif
#if 0
WRAPPER void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x5944B0); }
#else
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
{
for (int i = 0; i < 3; i++){
if (state->aAnimId[i] == NUM_ANIMS)
continue;
CAnimBlendAssociation* anim = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject,
state->aAnimId[i] > 3 ? ASSOCGRP_STD : ped->m_animGroup,
(AnimationId)state->aAnimId[i], 100.0f);
anim->SetCurrentTime(state->aCurTime[i] * 4.0f / 255.0f);
anim->speed = state->aSpeed[i] * 3.0f / 255.0f;
/* Lack of commented out calculation causes megajump */
anim->SetBlend(state->aBlendAmount[i] /* * 2.0f / 255.0f */, 1.0f);
anim->flags = state->aFlags[i];
uint8 callback = state->aFunctionCallbackID[i];
if (!callback)
anim->callbackType = CAnimBlendAssociation::CB_NONE;
else if (callback & 0x80)
anim->SetFinishCallback(FindCBFunction(callback & 0x7F), ped);
else
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
}
for (int i = 0; i < 6; i++) {
if (state->aAnimId2[i] == NUM_ANIMS)
continue;
CAnimBlendAssociation* anim = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject,
state->aAnimId2[i] > 3 ? ASSOCGRP_STD : ped->m_animGroup,
(AnimationId)state->aAnimId2[i], 100.0f);
anim->SetCurrentTime(state->aCurTime2[i] * 4.0f / 255.0f);
anim->speed = state->aSpeed2[i] * 3.0f / 255.0f;
/* Lack of commented out calculation causes megajump */
anim->SetBlend(state->aBlendAmount2[i] /* * 2.0f / 255.0f */, 1.0f);
anim->flags = state->aFlags2[i];
uint8 callback = state->aFunctionCallbackID2[i];
if (!callback)
anim->callbackType = CAnimBlendAssociation::CB_NONE;
else if (callback & 0x80)
anim->SetFinishCallback(FindCBFunction(callback & 0x7F), ped);
else
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
}
}
#endif
#if 0
WRAPPER void CReplay::PlaybackThisFrame(void) { EAXJMP(0x5946B0); }
#else
void CReplay::PlaybackThisFrame(void)
{
static int SlowMotionCounter = 0;
CAddressInReplayBuffer buf = Playback;
if (PlayBackThisFrameInterpolation(&buf, 1.0f, nil)){
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
return;
}
if (SlowMotionCounter){
CAddressInReplayBuffer buf_sm = buf;
if (PlayBackThisFrameInterpolation(&buf_sm, SlowMotionCounter * 1.0f / SlowMotion, nil)){
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
return;
}
}
SlowMotionCounter = (SlowMotionCounter + 1) % SlowMotion;
if (SlowMotionCounter == 0)
Playback = buf;
ProcessLookAroundCam();
DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0);
}
#endif
#if 0
WRAPPER void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) { EAXJMP(0x5947F0); }
@ -450,10 +613,325 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
Record.m_nOffset += sizeof(tVehicleUpdatePacket);
}
#endif
#if 0
WRAPPER void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594D10); }
#else
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
{
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
if (!vehicle){
debug("Replay:Car wasn't there");
return;
}
CMatrix vehicle_matrix;
vp->matrix.DecompressIntoFullMatrix(vehicle_matrix);
vehicle->GetMatrix() = vehicle->GetMatrix() * CMatrix(1.0f - interpolation);
*vehicle->GetMatrix().GetPosition() *= (1.0f - interpolation);
vehicle->GetMatrix() += CMatrix(interpolation) * vehicle_matrix;
vehicle->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
vehicle->m_fHealth = 4 * vp->health;
vehicle->m_fGasPedal = vp->acceleration / 100.0f;
if (vehicle->IsCar())
ApplyPanelDamageToCar(vp->panels, (CAutomobile*)vehicle, true);
vehicle->m_vecMoveSpeed = CVector(vp->velocityX / 8000.0f, vp->velocityY / 8000.0f, vp->velocityZ / 8000.0f);
if (vehicle->GetModelIndex() == MI_RHINO) {
((CAutomobile*)vehicle)->m_fCarGunLR = vp->car_gun * M_PI / 128.0f;
vehicle->m_fSteerAngle = 0.0f;
}else{
vehicle->m_fSteerAngle = vp->wheel_state / 50.0f;
}
if (vehicle->IsCar()) {
CAutomobile* car = (CAutomobile*)vehicle;
for (int i = 0; i < 4; i++) {
car->m_afWheelSuspDist[i] = vp->wheel_susp_dist[i] / 50.0f;
car->m_afWheelRotation[i] = vp->wheel_rotation[i] * M_PI / 128.0f;
}
car->m_aDoors[2].m_fAngle = car->m_aDoors[2].m_fPreviousAngle = vp->door_angles[0] * M_PI / 127.0f;
car->m_aDoors[3].m_fAngle = car->m_aDoors[3].m_fPreviousAngle = vp->door_angles[1] * M_PI / 127.0f;
if (vp->door_angles[0])
car->m_DamageManager.m_bDoorStatus[2] = 2;
if (vp->door_angles[1])
car->m_DamageManager.m_bDoorStatus[3] = 2;
if (vp->door_status & 1 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_BONNET) != 3){
car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_BONNET, 3);
car->SetDoorDamage(17, CDamageManager::CAR_DOOR_BONNET, true);
}
if (vp->door_status & 2 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_BUMPER) != 3) {
car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_BUMPER, 3);
car->SetDoorDamage(18, CDamageManager::CAR_DOOR_BUMPER, true);
}
if (vp->door_status & 4 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_LF) != 3) {
car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_LF, 3);
car->SetDoorDamage(15, CDamageManager::CAR_DOOR_LF, true);
}
if (vp->door_status & 8 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_RF) != 3) {
car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_RF, 3);
car->SetDoorDamage(11, CDamageManager::CAR_DOOR_RF, true);
}
if (vp->door_status & 0x10 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_LR) != 3) {
car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_LR, 3);
car->SetDoorDamage(16, CDamageManager::CAR_DOOR_LR, true);
}
if (vp->door_status & 0x20 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_RR) != 3) {
car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_RR, 3);
car->SetDoorDamage(12, CDamageManager::CAR_DOOR_RR, true);
}
vehicle->m_veh_flagA10 = true;
if (vehicle->IsCar())
((CAutomobile*)vehicle)->m_nDriveWheelsOnGround = 4;
CWorld::Remove(vehicle);
CWorld::Add(vehicle);
if (vehicle->IsBoat())
((CBoat*)vehicle)->m_bIsAnchored = false;
}
}
#endif
#if 0
WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer) { EAXJMP(0x595240); }
#else
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer){
/* Mistake. Not even sure what this is even doing here...
* PlayerWanted is a backup to restore at the end of replay.
* Setting current wanted pointer to it makes it useless.
* Causes picking up bribes in replays reducing wanted level bug.
* Obviously fact of picking them up is a bug on its own,
* but it doesn't cancel this one.
*/
FindPlayerPed()->m_pWanted = &PlayerWanted;
CBulletTraces::Init();
float split = 1.0f - interpolation;
int ped_min_index = 0; /* Optimization due to peds and vehicles placed in buffer sequentially. */
int vehicle_min_index = 0; /* So next ped can't have pool index less than current. */
for(;;){
uint8* ptr = buffer->m_pBase;
uint32 offset = buffer->m_nOffset;
uint8 type = ptr[offset];
if (type == REPLAYPACKET_ENDOFFRAME)
break;
switch (type) {
case REPLAYPACKET_END:
{
int slot = buffer->m_bSlot;
if (BufferStatus[slot] == REPLAYBUFFER_RECORD) {
FinishPlayback();
return true;
}
buffer->m_bSlot = (slot + 1) % 8;
buffer->m_nOffset = 0;
buffer->m_pBase = Buffers[buffer->m_bSlot];
ped_min_index = 0;
vehicle_min_index = 0;
break;
}
case REPLAYPACKET_VEHICLE:
{
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&ptr[offset];
for (int i = vehicle_min_index; i < vp->index; i++) {
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
if (!v)
continue;
/* Removing vehicles not present in this frame. */
CWorld::Remove(v);
delete v;
}
vehicle_min_index = vp->index + 1;
CVehicle* v = CPools::GetVehiclePool()->GetSlot(vp->index);
CVehicle* new_v;
if (!v) {
int mi = vp->mi;
if (CStreaming::ms_aInfoForModel[mi].m_loadState != 1) {
CStreaming::RequestModel(mi, 0);
}
else {
if (mi == MI_DEADDODO || mi == MI_AIRTRAIN) {
new_v = new(vp->index << 8) CPlane(mi, 2);
}
else if (mi == MI_TRAIN) {
new_v = new(vp->index << 8) CTrain(mi, 2);
}
else if (mi == MI_CHOPPER || mi == MI_ESCAPE) {
new_v = new(vp->index << 8) CHeli(mi, 2);
}
else if (CModelInfo::IsBoatModel(mi)){
new_v = new(vp->index << 8) CBoat(mi, 2);
}
else{
new_v = new(vp->index << 8) CAutomobile(mi, 2);
}
new_v->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
vp->matrix.DecompressIntoFullMatrix(new_v->GetMatrix());
new_v->m_currentColour1 = vp->primary_color;
new_v->m_currentColour2 = vp->secondary_color;
CWorld::Add(new_v);
}
}
ProcessCarUpdate(CPools::GetVehiclePool()->GetSlot(vp->index), interpolation, buffer);
buffer->m_nOffset += sizeof(tVehicleUpdatePacket);
break;
}
case REPLAYPACKET_PED_HEADER:
{
tPedHeaderPacket* ph = (tPedHeaderPacket*)&ptr[offset];
if (!CPools::GetPedPool()->GetSlot(ph->index)) {
if (CStreaming::ms_aInfoForModel[ph->mi].m_loadState != 1) {
CStreaming::RequestModel(ph->mi, 0);
}
else {
CPed* new_p = new(ph->index << 8) CCivilianPed(ph->pedtype, ph->mi);
new_p->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
new_p->GetMatrix().SetUnity();
CWorld::Add(new_p);
}
}
buffer->m_nOffset += sizeof(tPedHeaderPacket);
break;
}
case REPLAYPACKET_PED_UPDATE:
{
tPedUpdatePacket* pu = (tPedUpdatePacket*)&ptr[offset];
for (int i = ped_min_index; i < pu->index; i++) {
CPed* p = CPools::GetPedPool()->GetSlot(i);
if (!p)
continue;
/* Removing peds not present in this frame. */
CWorld::Remove(p);
delete p;
}
ped_min_index = pu->index + 1;
ProcessPedUpdate(CPools::GetPedPool()->GetSlot(pu->index), interpolation, buffer);
break;
}
case REPLAYPACKET_GENERAL:
{
tGeneralPacket* pg = (tGeneralPacket*)&ptr[offset];
TheCamera.GetMatrix() = TheCamera.GetMatrix() * CMatrix(split);
*TheCamera.GetMatrix().GetPosition() *= split;
TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos;
RwMatrix* pm = &RpAtomicGetFrame(&TheCamera.m_pRwCamera->object.object)->modelling;
pm->pos = *(RwV3d*)TheCamera.GetMatrix().GetPosition();
pm->at = *(RwV3d*)TheCamera.GetMatrix().GetForward();
pm->up = *(RwV3d*)TheCamera.GetMatrix().GetUp();
pm->right = *(RwV3d*)TheCamera.GetMatrix().GetRight();
CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x;
CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y;
CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z;
bPlayerInRCBuggy = pg->in_rcvehicle;
buffer->m_nOffset += sizeof(tGeneralPacket);
break;
}
case REPLAYPACKET_CLOCK:
{
tClockPacket* pc = (tClockPacket*)&ptr[offset];
CClock::SetGameClock(pc->hours, pc->minutes);
buffer->m_nOffset += sizeof(tClockPacket);
break;
}
case REPLAYPACKET_WEATHER:
{
tWeatherPacket* pw = (tWeatherPacket*)&ptr[offset];
CWeather::OldWeatherType = pw->old_weather;
CWeather::NewWeatherType = pw->new_weather;
CWeather::InterpolationValue = pw->interpolation;
buffer->m_nOffset += sizeof(tWeatherPacket);
break;
}
case REPLAYPACKET_ENDOFFRAME:
{
/* Not supposed to be here. */
buffer->m_nOffset++;
break;
}
case REPLAYPACKET_TIMER:
{
tTimerPacket* pt = (tTimerPacket*)&ptr[offset];
if (pTimer)
*pTimer = pt->timer;
CTimer::SetTimeInMilliseconds(pt->timer);
buffer->m_nOffset += sizeof(tTimerPacket);
break;
}
case REPLAYPACKET_BULLET_TRACES:
{
tBulletTracePacket* pb = (tBulletTracePacket*)&ptr[offset];
CBulletTraces::aTraces[pb->index].m_bInUse = true;
CBulletTraces::aTraces[pb->index].m_bFramesInUse = pb->frames;
CBulletTraces::aTraces[pb->index].m_bLifeTime = pb->lifetime;
CBulletTraces::aTraces[pb->index].m_vecInf = pb->inf;
CBulletTraces::aTraces[pb->index].m_vecSup = pb->sup;
buffer->m_nOffset += sizeof(tBulletTracePacket);
}
default:
break;
}
}
buffer->m_nOffset += 4;
for (int i = vehicle_min_index; i < CPools::GetVehiclePool()->GetSize(); i++) {
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
if (!v)
continue;
/* Removing vehicles not present in this frame. */
CWorld::Remove(v);
delete v;
}
for (int i = ped_min_index; i < CPools::GetPedPool()->GetSize(); i++) {
CPed* p = CPools::GetPedPool()->GetSlot(i);
if (!p)
continue;
/* Removing peds not present in this frame. */
CWorld::Remove(p);
delete p;
}
ProcessReplayCamera();
return false;
}
#endif
#if 0
WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); }
WRAPPER void CReplay::Shutdown(void) { EAXJMP(0x595BD0); }
#else
void CReplay::FinishPlayback(void)
{
if (Mode != MODE_PLAYBACK)
return;
EmptyAllPools();
RestoreStuffFromMem();
Mode = MODE_RECORD;
if (bDoLoadSceneWhenDone){
CVector v_ls(LoadSceneX, LoadSceneY, LoadSceneZ);
CGame::currLevel = CTheZones::GetLevelFromPosition(v_ls);
CCollision::SortOutCollisionAfterLoad();
CStreaming::LoadScene(v_ls);
}
bDoLoadSceneWhenDone = false;
if (bPlayingBackFromFile){
Init();
MarkEverythingAsNew();
}
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
}
#endif
#if 0
WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); }
#else
void CReplay::EmptyReplayBuffer(void)
{
if (Mode == MODE_PLAYBACK)
return;
for (int i = 0; i < 8; i++){
BufferStatus[i] = REPLAYBUFFER_UNUSED;
}
Record.m_bSlot = 0;
Record.m_pBase = Buffers[0];
BufferStatus[0] = REPLAYBUFFER_RECORD;
Record.m_pBase[Record.m_nOffset] = 0;
MarkEverythingAsNew();
}
#endif
WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); }
#if 0
@ -510,7 +988,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
}
#endif
#if 1
#if 0
WRAPPER void CReplay::StoreStuffInMem(void) { EAXJMP(0x5961F0); }
#else
void CReplay::StoreStuffInMem(void)
@ -521,19 +999,19 @@ void CReplay::StoreStuffInMem(void)
CPools::GetPtrNodePool()->Store(pBuf6, pBuf7);
CPools::GetEntryInfoNodePool()->Store(pBuf8, pBuf9);
CPools::GetDummyPool()->Store(pBuf10, pBuf11);
pWorld1 = (CSector*)malloc(sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y);
pWorld1 = new uint8[sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y];
memcpy(pWorld1, CWorld::GetSector(0, 0), NUMSECTORS_X * NUMSECTORS_Y * sizeof(CSector));
WorldPtrList = CWorld::GetMovingEntityList(); /* Interesting way to copy a list... */
WorldPtrList = CWorld::GetMovingEntityList();
BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE);
pPickups = (CPickup*)malloc(sizeof(CPickup) * NUMPICKUPS);
pPickups = new uint8[sizeof(CPickup) * NUMPICKUPS];
memcpy(pPickups, CPickups::aPickUps, NUMPICKUPS * sizeof(CPickup));
pReferences = (CReference*)malloc(sizeof(CReference) * NUMREFERENCES);
pReferences = new uint8[(sizeof(CReference) * NUMREFERENCES)];
memcpy(pReferences, CReferences::aRefs, NUMREFERENCES * sizeof(CReference));
pEmptyReferences = CReferences::pEmptyList;
pStoredCam = (CCamera*)malloc(sizeof(CCamera));
pStoredCam = new uint8[sizeof(CCamera)];
memcpy(pStoredCam, &TheCamera, sizeof(CCamera));
pRadarBlips = (CBlip*)malloc(sizeof(CBlip) * NUMBLIPS);
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMBLIPS * sizeof(CBlip));
pRadarBlips = new uint8[sizeof(CBlip) * NUMRADARBLIPS];
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(CBlip));
PlayerWanted = *FindPlayerPed()->m_pWanted;
PlayerInfo = CWorld::Players[0];
Time1 = CTimer::GetTimeInMilliseconds();
@ -559,7 +1037,7 @@ void CReplay::StoreStuffInMem(void)
}
#endif
#if 1
#if 0
WRAPPER void CReplay::RestoreStuffFromMem(void) { EAXJMP(0x5966E0); }
#else
void CReplay::RestoreStuffFromMem(void)
@ -571,28 +1049,28 @@ void CReplay::RestoreStuffFromMem(void)
CPools::GetEntryInfoNodePool()->CopyBack(pBuf8, pBuf9);
CPools::GetDummyPool()->CopyBack(pBuf10, pBuf11);
memcpy(CWorld::GetSector(0, 0), pWorld1, sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y);
free(pWorld1);
delete[] pWorld1;
pWorld1 = nil;
CWorld::GetMovingEntityList() = WorldPtrList;
CWorld::GetBigBuildingList(LEVEL_NONE) = BigBuildingPtrList;
memcpy(CPickups::aPickUps, pPickups, sizeof(CPickup) * NUMPICKUPS);
free(pPickups);
delete[] pPickups;
pPickups = nil;
memcpy(CReferences::aRefs, pReferences, sizeof(CReference) * NUMREFERENCES);
free(pReferences);
delete[] pReferences;
pReferences = nil;
CReferences::pEmptyList = pEmptyReferences;
pEmptyReferences = nil;
memcpy(&TheCamera, pStoredCam, sizeof(CCamera));
free(pStoredCam);
delete[] pStoredCam;
pStoredCam = nil;
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(CBlip) * NUMBLIPS);
free(pRadarBlips);
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(CBlip) * NUMRADARBLIPS);
delete[] pRadarBlips;
pRadarBlips = nil;
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted); /* Nice memory leak */
CWorld::Players[0] = PlayerInfo;
int size = CPools::GetPedPool()->GetSize();
for (int i = size - 1; i >= 0; i--){
int i = CPools::GetPedPool()->GetSize();
while (--i){
CPed* ped = CPools::GetPedPool()->GetSlot(i);
if (!ped)
continue;
@ -609,8 +1087,8 @@ void CReplay::RestoreStuffFromMem(void)
if (ped->m_wepModelID >= 0)
ped->AddWeaponModel(ped->m_wepModelID);
}
size = CPools::GetVehiclePool()->GetSize();
for (int i = size - 1; i >= 0; i--) {
i = CPools::GetVehiclePool()->GetSize();
while (--i){
CVehicle* vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!vehicle)
continue;
@ -668,8 +1146,8 @@ void CReplay::RestoreStuffFromMem(void)
}
}
PrintElementsInPtrList();
size = CPools::GetObjectPool()->GetSize();
for (int i = size - 1; i >= 0; i--) {
i = CPools::GetObjectPool()->GetSize();
while (--i){
CObject* object = CPools::GetObjectPool()->GetSlot(i);
if (!object)
continue;
@ -683,8 +1161,8 @@ void CReplay::RestoreStuffFromMem(void)
if (RwObjectGetType(object->m_rwObject) == rpATOMIC)
object->GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame(object->m_rwObject)), false);
}
size = CPools::GetDummyPool()->GetSize();
for (int i = size - 1; i >= 0; i--) {
i = CPools::GetDummyPool()->GetSize();
while (--i){
CDummy* dummy = CPools::GetDummyPool()->GetSlot(i);
if (!dummy)
continue;
@ -710,8 +1188,7 @@ void CReplay::RestoreStuffFromMem(void)
CWeather::OldWeatherType = OldWeatherType;
CWeather::NewWeatherType = NewWeatherType;
CWeather::InterpolationValue = WeatherInterpolationValue;
size = CPools::GetPedPool()->GetSize();
for (int i = 0; i < size; i++) {
for (int i = 0; i < CPools::GetPedPool()->GetSize(); i++) {
CPed* ped = CPools::GetPedPool()->GetSlot(i);
if (!ped)
continue;
@ -756,7 +1233,12 @@ STARTPATCHES
InjectHook(0x592FC0, PrintElementsInPtrList, PATCH_JUMP);
InjectHook(0x592FE0, CReplay::Init, PATCH_JUMP);
InjectHook(0x593150, CReplay::DisableReplays, PATCH_JUMP);
InjectHook(0x593150, CReplay::EnableReplays, PATCH_JUMP);
InjectHook(0x593160, CReplay::EnableReplays, PATCH_JUMP);
InjectHook(0x593170, CReplay::Update, PATCH_JUMP);
//InjectHook(0x5966E0, CReplay::RestoreStuffFromMem, PATCH_JUMP);
InjectHook(0x595B20, CReplay::FinishPlayback, PATCH_JUMP);
InjectHook(0x594050, CReplay::ProcessPedUpdate, PATCH_JUMP);
InjectHook(0x594D10, CReplay::ProcessCarUpdate, PATCH_JUMP);
InjectHook(0x593BB0, CReplay::StoreDetailedPedAnimation, PATCH_JUMP);
InjectHook(0x5944B0, CReplay::RetrieveDetailedPedAnimation, PATCH_JUMP);
InjectHook(0x596030, CReplay::TriggerPlayback, PATCH_JUMP);
ENDPATCHES

View file

@ -155,7 +155,7 @@ class CReplay
int8 vehicle_index;
CStoredAnimationState anim_state;
CCompressedMatrixNotAligned matrix;
uint8 assoc_group_id;
int8 assoc_group_id;
uint8 weapon_model;
};
static_assert(sizeof(tPedUpdatePacket) == 40, "tPedUpdatePacket: error");
@ -201,13 +201,13 @@ private:
static CEntryInfoNode *&pBuf9;
static uint8 *&pBuf10;
static CDummyPed *&pBuf11;
static CBlip *&pRadarBlips;
static CCamera *&pStoredCam;
static CSector *&pWorld1;
static uint8 *&pRadarBlips;
static uint8 *&pStoredCam;
static uint8 *&pWorld1;
static CReference *&pEmptyReferences;
static CStoredDetailedAnimationState *&pPedAnims;
static CPickup *&pPickups;
static CReference *&pReferences;
static uint8 *&pPickups;
static uint8 *&pReferences;
static uint8 (&BufferStatus)[8];
static uint8 (&Buffers)[8][100000];
static bool &bPlayingBackFromFile;
@ -241,15 +241,18 @@ private:
static float &LoadSceneX;
static float &LoadSceneY;
static float &LoadSceneZ;
static float &CameraFocusX;
static float &CameraFocusY;
static float &CameraFocusZ;
static bool &bPlayerInRCBuggy;
public:
static void Init(void);
static void EmptyReplayBuffer(void);
static void DisableReplays(void);
static void EnableReplays(void);
static void Update(void);
static void FinishPlayback(void);
static void Shutdown(void);
static void EmptyReplayBuffer(void);
static void Display(void);
static void TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene);
static void StreamAllNecessaryCarsAndPeds(void);
@ -258,7 +261,7 @@ public:
inline static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; }
inline static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; }
private:
//private:
static void RecordThisFrame(void);
static void StorePedUpdate(CPed *ped, int id);
static void StorePedAnimation(CPed *ped, CStoredAnimationState *state);
@ -272,9 +275,7 @@ private:
static bool PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer);
static void ProcessReplayCamera(void);
static void StoreStuffInMem(void);
public: /* temp */
static void RestoreStuffFromMem(void);
private:
static void EmptyPedsAndVehiclePools(void);
static void EmptyAllPools(void);
static void MarkEverythingAsNew(void);

View file

@ -75,7 +75,7 @@ inline bool DebugMenuLoad(void)
if(gDebugMenuAPI.isLoaded)
return true;
HMODULE mod = LoadLibraryA("debugmenu");
if(mod == 0){
if(mod == nil){
char modulePath[MAX_PATH];
HMODULE dllModule;
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)&gDebugMenuAPI, &dllModule);
@ -85,7 +85,7 @@ inline bool DebugMenuLoad(void)
strcat(modulePath, "debugmenu");
mod = LoadLibraryA(modulePath);
}
if(mod == 0)
if(mod == nil)
return false;
gDebugMenuAPI.addint8 = (DebugMenuAddInt8_TYPE)GetProcAddress(mod, "DebugMenuAddInt8");
gDebugMenuAPI.addint16 = (DebugMenuAddInt16_TYPE)GetProcAddress(mod, "DebugMenuAddInt16");

View file

@ -2,4 +2,15 @@
#include "patcher.h"
#include "Automobile.h"
WRAPPER void CAutomobile::SetDoorDamage(int32, uint32, bool) { EAXJMP(0x530200); }
CAutomobile::CAutomobile(int mi, uint8 owner)
{
ctor(mi, owner);
}
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
WRAPPER void CAutomobile::SetDoorDamage(int32, uint32, bool) { EAXJMP(0x530200); }
STARTPATCHES
InjectHook(0x52D170, &CAutomobile::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -18,9 +18,14 @@ public:
float m_afWheelRotation[4];
uint8 stuff3[200];
float m_fCarGunLR;
uint8 stuff4[36];
uint8 stuff4[13];
uint8 m_nDriveWheelsOnGround;
uint8 stuff5[22];
CAutomobile(int, uint8);
CAutomobile* ctor(int, uint8);
void SetDoorDamage(int32, uint32, bool); /* TODO: eDoors */
void dtor() { this->CAutomobile::~CAutomobile(); }
};
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");
static_assert(offsetof(CAutomobile, m_afWheelSuspDist) == 0x46C, "CAutomobile: error");

14
src/entities/Boat.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "Boat.h"
CBoat::CBoat(int mi, uint8 owner)
{
ctor(mi, owner);
}
WRAPPER CBoat* CBoat::ctor(int, uint8) { EAXJMP(0x53E3E0); }
STARTPATCHES
InjectHook(0x53E790, &CBoat::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -6,6 +6,12 @@ class CBoat : public CVehicle
{
public:
// 0x288
uint8 stuff[508];
uint8 stuff1[57];
bool m_bIsAnchored;
uint8 stuff[450];
CBoat(int, uint8);
CBoat* ctor(int, uint8);
void dtor() { this->CBoat::~CBoat(); };
};
static_assert(sizeof(CBoat) == 0x484, "CBoat: error");

View file

@ -23,5 +23,6 @@ CBuilding::ReplaceWithNewModel(int32 id)
STARTPATCHES
InjectHook(0x4057D0, &CBuilding::ctor, PATCH_JUMP);
InjectHook(0x405800, &CBuilding::dtor, PATCH_JUMP);
InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
ENDPATCHES

View file

@ -17,5 +17,6 @@ public:
virtual bool GetIsATreadable(void) { return false; }
CBuilding *ctor(void) { return ::new (this) CBuilding(); }
void dtor(void) { this->CBuilding::~CBuilding(); }
};
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");

View file

@ -0,0 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "CivilianPed.h"
CCivilianPed::CCivilianPed(int pedtype, int mi)
{
ctor(pedtype, mi);
}
WRAPPER CCivilianPed* CCivilianPed::ctor(int pedtype, int mi) { EAXJMP(0x4BFF30); }
STARTPATCHES
InjectHook(0x4BFFC0, &CCivilianPed::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -5,5 +5,8 @@
class CCivilianPed : public CPed
{
public:
CCivilianPed(int, int);
CCivilianPed* ctor(int, int);
void dtor(void) { this->CCivilianPed::~CCivilianPed(); }
};
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error");

14
src/entities/CopPed.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "CopPed.h"
CCopPed::~CCopPed()
{
ClearPursuit();
}
WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
STARTPATCHES
InjectHook(0x4C13E0, &CCopPed::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -63,6 +63,11 @@ public:
int8 field_1365;
int8 field_1366;
int8 field_1367;
~CCopPed();
void dtor(void) { this->CCopPed::~CCopPed(); }
void ClearPursuit(void);
};
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");

View file

@ -1,14 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "main.h"
#include "lights.h"
#include "Lights.h"
#include "PointLights.h"
#include "RpAnimBlend.h"
#include "AnimBlendClumpData.h"
#include "Renderer.h"
#include "ModelIndices.h"
#include "Shadows.h"
#include "TimeCycle.h"
#include "Timecycle.h"
#include "CutsceneObject.h"
CCutsceneObject::CCutsceneObject(void)
@ -90,6 +90,7 @@ CCutsceneObject::RemoveLighting(bool reset)
}
STARTPATCHES
InjectHook(0x4BA960, &CCutsceneObject::dtor, PATCH_JUMP);
InjectHook(0x4BA980, &CCutsceneObject::SetModelIndex_, PATCH_JUMP);
InjectHook(0x4BA9C0, &CCutsceneObject::ProcessControl_, PATCH_JUMP);
InjectHook(0x4BAA40, &CCutsceneObject::PreRender_, PATCH_JUMP);

View file

@ -14,7 +14,7 @@ public:
bool SetupLighting(void);
void RemoveLighting(bool reset);
void dtor(void) { this->CCutsceneObject::~CCutsceneObject(); }
void SetModelIndex_(uint32 id) { CCutsceneObject::SetModelIndex(id); }
void ProcessControl_(void) { CCutsceneObject::ProcessControl(); }
void PreRender_(void) { CCutsceneObject::PreRender(); }

View file

@ -31,7 +31,7 @@ CDummy::Add(void)
for(x = xstart; x <= xend; x++){
s = CWorld::GetSector(x, y);
if(x == xmid && y == ymid)
list = &s->m_lists[ENTITYLIST_OBJECTS];
list = &s->m_lists[ENTITYLIST_DUMMIES];
else
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
CPtrNode *node = list->InsertItem(this);
@ -52,6 +52,7 @@ CDummy::Remove(void)
}
STARTPATCHES
InjectHook(0x473810, &CDummy::dtor, PATCH_JUMP);
InjectHook(0x473860, &CDummy::Add_, PATCH_JUMP);
InjectHook(0x473AD0, &CDummy::Remove_, PATCH_JUMP);
ENDPATCHES

View file

@ -18,5 +18,6 @@ public:
// to make patching virtual functions possible
void Add_(void) { CDummy::Add(); }
void Remove_(void) { CDummy::Remove(); }
void dtor(void) { this->CDummy::~CDummy(); }
};
static_assert(sizeof(CDummy) == 0x68, "CDummy: error");

View file

@ -11,3 +11,7 @@ CDummyObject::CDummyObject(CObject *obj)
obj->DetachFromRwObject();
m_level = obj->m_level;
}
STARTPATCHES
InjectHook(0x4BAB70, &CDummyObject::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -9,5 +9,6 @@ class CDummyObject : public CDummy
public:
CDummyObject(void) {}
CDummyObject(CObject *obj);
void dtor(void) { this->CDummyObject::~CDummyObject(); }
};
static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error");

View file

@ -7,5 +7,7 @@ class CEmergencyPed : public CPed
public:
// 0x53C
uint8 stuff[24];
void dtor(void) { this->CEmergencyPed::~CEmergencyPed(); }
};
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");

View file

@ -449,6 +449,8 @@ CEntity::PruneReferences(void)
STARTPATCHES
InjectHook(0x473C30, &CEntity::ctor, PATCH_JUMP);
InjectHook(0x473E40, &CEntity::dtor, PATCH_JUMP);
InjectHook(0x473E70, &CEntity::SetModelIndex_, PATCH_JUMP);
InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP);
InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP);
InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP);

View file

@ -156,8 +156,10 @@ public:
// to make patching virtual functions possible
CEntity *ctor(void) { return ::new (this) CEntity(); }
void dtor(void) { this->CEntity::~CEntity(); }
void Add_(void) { CEntity::Add(); }
void Remove_(void) { CEntity::Remove(); }
void SetModelIndex_(uint32 i) { CEntity::SetModelIndex(i); }
void CreateRwObject_(void) { CEntity::CreateRwObject(); }
void DeleteRwObject_(void) { CEntity::DeleteRwObject(); }
CRect GetBoundRect_(void) { return CEntity::GetBoundRect(); }

View file

@ -2,4 +2,14 @@
#include "patcher.h"
#include "Heli.h"
CHeli::CHeli(int mi, uint8 owner)
{
ctor(mi, owner);
}
WRAPPER CHeli* CHeli::ctor(int, uint8) { EAXJMP(0x547220); }
WRAPPER void CHeli::SpecialHeliPreRender(void) { EAXJMP(0x54AE10); }
STARTPATCHES
InjectHook(0x5474A0, &CHeli::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -8,6 +8,10 @@ public:
// 0x288
uint8 stuff[180];
CHeli(int, uint8);
CHeli* ctor(int, uint8);
void dtor(void) { this->CHeli::~CHeli(); }
static void SpecialHeliPreRender(void);
};
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");

View file

@ -66,5 +66,6 @@ CObject::Render(void)
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
STARTPATCHES
InjectHook(0x4BAE00, &CObject::dtor, PATCH_JUMP);
InjectHook(0x4BB1E0, &CObject::Render_, PATCH_JUMP);
ENDPATCHES

View file

@ -73,6 +73,7 @@ public:
static void DeleteAllTempObjectInArea(CVector, float);
void dtor(void) { this->CObject::~CObject(); }
void Render_(void) { CObject::Render(); }
};
static_assert(sizeof(CObject) == 0x198, "CObject: error");

View file

@ -4,7 +4,7 @@
#include "Particle.h"
#include "Stats.h"
#include "World.h"
#include "DMaudio.h"
#include "DMAudio.h"
#include "RpAnimBlend.h"
#include "Ped.h"
#include "PlayerPed.h"
@ -17,6 +17,7 @@
#include "Shadows.h"
#include "Weather.h"
#include "CullZones.h"
#include "Population.h"
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
@ -27,8 +28,66 @@ CVector &CPed::offsetToOpenLowCarDoor = *(CVector*)0x62E03C;
CVector &CPed::offsetToOpenVanDoor = *(CVector*)0x62E048;
void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->New(handle); }
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
CPed::~CPed(void)
{
CWorld::Remove(this);
CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this));
if (bInVehicle && m_pMyVehicle){
uint8 door_flag = 0;
switch (m_vehEnterType) {
case VEHICLE_ENTER_FRONT_LEFT: door_flag = 1; break;
case VEHICLE_ENTER_REAR_LEFT: door_flag = 2; break;
case VEHICLE_ENTER_FRONT_RIGHT: door_flag = 4; break;
case VEHICLE_ENTER_REAR_RIGHT: door_flag = 8; break;
default: break;
}
if (m_pMyVehicle->pDriver == this)
m_pMyVehicle->pDriver = nil;
else {
for (int i = 0; i < m_pMyVehicle->m_nNumMaxPassengers; i++) {
if (m_pMyVehicle->pPassengers[i] == this)
m_pMyVehicle->pPassengers[i] = nil;
}
}
if (m_nPedState == PED_EXIT_CAR || m_nPedState == PED_DRAG_FROM_CAR)
m_pMyVehicle->m_nGettingOutFlags &= ~door_flag;
bInVehicle = false;
m_pMyVehicle = nil;
}else if (m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK){
QuitEnteringCar();
}
if (m_pFire)
m_pFire->Extinguish();
CPopulation::UpdatePedCount(m_nPedType, true);
DMAudio.DestroyEntity(m_audioEntityId);
}
void CPed::FlagToDestroyWhenNextProcessed(void)
{
bRemoveFromWorld = true;
if (!bInVehicle || !m_pMyVehicle)
return;
if (m_pMyVehicle->pDriver == this){
m_pMyVehicle->pDriver = nil;
if (IsPlayer() && m_pMyVehicle->m_status != STATUS_WRECKED)
m_pMyVehicle->m_status = STATUS_ABANDONED;
}else{
m_pMyVehicle->RemovePassenger(this);
}
bInVehicle = false;
m_pMyVehicle = nil;
if (m_nCreatedBy == 2) /* TODO: enum (MISSION) */
m_nPedState = PED_DEAD;
else
m_nPedState = PED_NONE;
m_pVehicleAnim = nil;
}
WRAPPER void CPed::QuitEnteringCar() { EAXJMP(0x4E0E00); }
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
@ -416,7 +475,7 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
if (nodeId != PED_HEAD)
CPed::SpawnFlyingComponent(nodeId, unk);
RecurseFrameChildrenVisibilityCB(frame, 0);
RecurseFrameChildrenVisibilityCB(frame, nil);
pos.x = 0.0f;
pos.y = 0.0f;
pos.z = 0.0f;
@ -447,7 +506,7 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
RwObject*
CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data)
{
if (data == 0)
if (data == nil)
RpAtomicSetFlags(object, 0);
return object;
}
@ -456,7 +515,7 @@ RwFrame*
CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data)
{
RwFrameForAllObjects(frame, SetPedAtomicVisibilityCB, data);
RwFrameForAllChildren(frame, RecurseFrameChildrenVisibilityCB, 0);
RwFrameForAllChildren(frame, RecurseFrameChildrenVisibilityCB, nil);
return frame;
}
@ -824,7 +883,7 @@ CPed::Attack(void)
&& GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) {
weaponAnim = weaponAnimAssoc->animId;
if (ourWeaponFire != WEAPON_FIRE_MELEE || CheckForPedsOnGroundToAttack(((CPlayerPed*)this), 0) < PED_ON_THE_FLOOR) {
if (ourWeaponFire != WEAPON_FIRE_MELEE || CheckForPedsOnGroundToAttack(((CPlayerPed*)this), nil) < PED_ON_THE_FLOOR) {
if (weaponAnim != ourWeapon->m_Anim2ToPlay || weaponAnim == ANIM_RBLOCK_CSHOOT) {
weaponAnimAssoc->Start(ourWeapon->m_fAnimLoopStart);
} else {
@ -873,7 +932,7 @@ CPed::Attack(void)
if (lastReloadWasInFuture) {
if (ourWeaponFire != WEAPON_FIRE_PROJECTILE || !CPed::IsPlayer() || ((CPlayerPed*)this)->field_1380) {
if (!CGame::nastyGame || ourWeaponFire != WEAPON_FIRE_MELEE || CheckForPedsOnGroundToAttack(((CPlayerPed*)this), 0) < PED_ON_THE_FLOOR) {
if (!CGame::nastyGame || ourWeaponFire != WEAPON_FIRE_MELEE || CheckForPedsOnGroundToAttack(((CPlayerPed*)this), nil) < PED_ON_THE_FLOOR) {
weaponAnimAssoc = CAnimManager::BlendAnimation((RpClump*)m_rwObject, ASSOCGRP_STD, ourWeapon->m_AnimToPlay, 8.0f);
} else {
weaponAnimAssoc = CAnimManager::BlendAnimation((RpClump*)m_rwObject, ASSOCGRP_STD, ourWeapon->m_Anim2ToPlay, 8.0f);
@ -892,14 +951,14 @@ CPed::Attack(void)
}
}
else
CPed::FinishedAttackCB(0, this);
CPed::FinishedAttackCB(nil, this);
}
void
CPed::RemoveWeaponModel(int modelId)
{
// modelId is not used!! This function just removes the current weapon.
RwFrameForAllObjects(GetNodeFrame(PED_HANDR),RemoveAllModelCB,0);
RwFrameForAllObjects(GetNodeFrame(PED_HANDR),RemoveAllModelCB,nil);
m_wepModelID = -1;
}
@ -1621,10 +1680,11 @@ WRAPPER void CPed::FinishFightMoveCB(CAnimBlendAssociation *assoc, void *arg) {
WRAPPER void CPed::PedAnimDoorCloseRollingCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E4B90); }
WRAPPER void CPed::FinishJumpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D7A50); }
WRAPPER void CPed::PedLandCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8A0); }
WRAPPER void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4C6620); }
WRAPPER void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4C6580); }
WRAPPER void CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D6550); }
STARTPATCHES
InjectHook(0x4C50D0, &CPed::dtor, PATCH_JUMP);
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);

View file

@ -9,6 +9,7 @@
#include "AnimBlendClumpData.h"
#include "AnimBlendAssociation.h"
#include "WeaponInfo.h"
#include "Fire.h"
struct CPathNode;
@ -85,15 +86,15 @@ enum PedState
PED_PASSENGER,
PED_TAXI_PASSENGER,
PED_OPEN_DOOR,
PED_DIE,
PED_DEAD,
PED_DIE = 48,
PED_DEAD = 49,
PED_CARJACK,
PED_DRAG_FROM_CAR,
PED_ENTER_CAR,
PED_STEAL_CAR,
PED_EXIT_CAR,
PED_HANDS_UP,
PED_ARRESTED,
PED_ARRESTED = 56,
};
enum {
@ -184,7 +185,9 @@ public:
uint8 m_ped_flagI20 : 1;
uint8 m_ped_flagI40 : 1;
uint8 m_ped_flagI80 : 1;
uint8 stuff10[15];
uint8 stuff10[3];
uint8 m_nCreatedBy;
uint8 stuff14[11];
CPed *m_field_16C;
uint8 stuff12[44];
int32 m_pEventEntity;
@ -243,7 +246,8 @@ public:
uint8 stuff[2];
int32 m_pPointGunAt;
CVector m_vecHitLastPos;
uint8 stuff8[12];
uint8 stuff8[8];
CFire* m_pFire;
CEntity *m_pLookTarget;
float m_fLookDirection;
int32 m_wepModelID;
@ -266,7 +270,14 @@ public:
uint8 stuff11[30];
static void *operator new(size_t);
static void *operator new(size_t, int);
static void operator delete(void*, size_t);
static void operator delete(void*, int);
~CPed(void);
void FlagToDestroyWhenNextProcessed(void);
void dtor(void) { this->CPed::~CPed(); }
bool IsPlayer(void);
bool UseGroundColModel(void);
@ -301,6 +312,7 @@ public:
void LineUpPedWithCar(PedLineUpPhase phase);
void SetPedPositionInCar(void);
void PlayFootSteps(void);
void QuitEnteringCar(void);
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
static void GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult);
static void GetPositionToOpenCarDoor(CVector* output, CVehicle* veh, uint32 enterType);

View file

@ -1895,6 +1895,7 @@ CPhysical::ProcessCollision(void)
STARTPATCHES
InjectHook(0x495130, &CPhysical::dtor, PATCH_JUMP);
InjectHook(0x4951F0, &CPhysical::Add_, PATCH_JUMP);
InjectHook(0x4954B0, &CPhysical::Remove_, PATCH_JUMP);
InjectHook(0x495540, &CPhysical::RemoveAndAdd, PATCH_JUMP);

View file

@ -134,6 +134,7 @@ public:
void ProcessCollision(void);
// to make patching virtual functions possible
void dtor(void) { this->CPhysical::~CPhysical(); }
void Add_(void) { CPhysical::Add(); }
void Remove_(void) { CPhysical::Remove(); }
CRect GetBoundRect_(void) { return CPhysical::GetBoundRect(); }

19
src/entities/Plane.cpp Normal file
View file

@ -0,0 +1,19 @@
#include "common.h"
#include "patcher.h"
#include "Plane.h"
CPlane::CPlane(int mi, uint8 owner)
{
ctor(mi, owner);
}
WRAPPER CPlane* CPlane::ctor(int, uint8) { EAXJMP(0x54B170); }
CPlane::~CPlane()
{
DeleteRwObject();
}
STARTPATCHES
InjectHook(0x54B270, &CPlane::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -1,5 +1,6 @@
#pragma once
#include "common.h"
#include "Vehicle.h"
class CPlane : public CVehicle
@ -7,5 +8,11 @@ class CPlane : public CVehicle
public:
// 0x288
uint8 stuff[20];
CPlane(int, uint8);
~CPlane(void);
CPlane* ctor(int, uint8);
void dtor(void) { this->CPlane::~CPlane(); }
void FlagToDestroyWhenNextProcessed() { bRemoveFromWorld = true; }
};
static_assert(sizeof(CPlane) == 0x29C, "CPlane: error");

View file

@ -0,0 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "PlayerPed.h"
CPlayerPed::~CPlayerPed()
{
delete m_pWanted;
}
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
STARTPATCHES
InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -38,6 +38,11 @@ public:
int32 field_1488[6];
float field_1512;
float m_fFPSMoveHeading;
~CPlayerPed();
void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
void ReApplyMoveAnims(void);
};
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");

View file

@ -0,0 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "Projectile.h"
STARTPATCHES
InjectHook(0x4BFED0, &CProjectile::dtor, PATCH_JUMP);
ENDPATCHES

11
src/entities/Projectile.h Normal file
View file

@ -0,0 +1,11 @@
#pragma once
#pragma once
#include "Object.h"
class CProjectile : public CObject
{
public:
void dtor(void) { this->CProjectile::~CProjectile(); }
};

14
src/entities/Train.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "Train.h"
CTrain::CTrain(int mi, uint8 owner)
{
ctor(mi, owner);
}
WRAPPER CTrain* CTrain::ctor(int, uint8) { EAXJMP(0x54E2A0); }
STARTPATCHES
InjectHook(0x54E450, &CTrain::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -1,5 +1,7 @@
#pragma once
#include "common.h"
#include "patcher.h"
#include "Vehicle.h"
enum
@ -16,5 +18,9 @@ public:
uint8 stuff2[7];
int16 m_doorState;
uint8 stuff3[62];
CTrain(int, uint8);
CTrain* ctor(int, uint8);
void dtor(void) { this->CTrain::~CTrain(); }
};
static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error");

View file

@ -1,7 +1,12 @@
#include "common.h"
#include "patcher.h"
#include "rpworld.h"
#include "Treadable.h"
#include "Pools.h"
void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); }
void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
STARTPATCHES
InjectHook(0x405A10, &CTreadable::dtor, PATCH_JUMP);
ENDPATCHES

View file

@ -12,5 +12,6 @@ public:
int16 m_nodeIndicesPeds[12];
virtual bool GetIsATreadable(void) { return true; }
void dtor(void) { this->CTreadable::~CTreadable(); }
};
static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error");

View file

@ -4,6 +4,8 @@
#include "Pools.h"
#include "CarCtrl.h"
#include "ModelIndices.h"
#include "DMAudio.h"
#include "Radar.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
@ -12,7 +14,36 @@ bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
CVehicle::~CVehicle()
{
m_nAlarmState = 0;
if (m_audioEntityId >= 0){
DMAudio.DestroyEntity(m_audioEntityId);
m_audioEntityId = -5;
}
CRadar::ClearBlipForEntity(BLIP_CAR, CPools::GetVehiclePool()->GetIndex(this));
if (pDriver)
pDriver->FlagToDestroyWhenNextProcessed();
for (int i = 0; i < m_nNumMaxPassengers; i++){
if (pPassengers[i])
pPassengers[i]->FlagToDestroyWhenNextProcessed();
}
if (m_pCarFire)
m_pCarFire->Extinguish();
CCarCtrl::UpdateCarCount(this, true);
if (bIsAmbulanceOnDuty){
CCarCtrl::NumAmbulancesOnDuty--;
bIsAmbulanceOnDuty = false;
}
if (bIsFiretruckOnDuty){
CCarCtrl::NumFiretrucksOnDuty--;
bIsFiretruckOnDuty = false;
}
}
bool
CVehicle::IsLawEnforcementVehicle(void)
@ -46,6 +77,28 @@ CVehicle::ChangeLawEnforcerState(bool enable)
}
}
void
CVehicle::RemovePassenger(CPed *p)
{
if (IsTrain()){
for (int i = 0; i < 8; i++){
if (pPassengers[i] == p) {
pPassengers[i] = nil;
m_nNumPassengers--;
return;
}
}
return;
}
for (int i = 0; i < m_nNumMaxPassengers; i++){
if (pPassengers[i] == p){
pPassengers[i] = nil;
m_nNumPassengers--;
return;
}
}
}
void
CVehicle::RemoveDriver(void)
{

View file

@ -50,8 +50,8 @@ public:
float m_fBreakPedal;
uint8 m_nCreatedBy; // eVehicleCreatedBy
uint8 bIsLawEnforcer : 1;
uint8 m_veh_flagA2 : 1;
uint8 m_veh_flagA4 : 1;
uint8 bIsAmbulanceOnDuty : 1;
uint8 bIsFiretruckOnDuty : 1;
uint8 m_veh_flagA8 : 1;
uint8 m_veh_flagA10 : 1;
uint8 m_veh_flagA20 : 1;
@ -111,7 +111,13 @@ public:
eVehicleType m_vehType;
static void *operator new(size_t);
static void *operator new(size_t sz, int slot);
static void operator delete(void*, size_t);
static void operator delete(void*, int);
~CVehicle(void);
void dtor(void) { this->CVehicle::~CVehicle(); }
bool IsCar(void) { return m_vehType == VEHICLE_TYPE_CAR; }
bool IsBoat(void) { return m_vehType == VEHICLE_TYPE_BOAT; }
@ -120,6 +126,7 @@ public:
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
bool IsLawEnforcementVehicle(void);
void ChangeLawEnforcerState(bool enable);
void RemovePassenger(CPed *);
void RemoveDriver(void);
bool IsUpsideDown(void);

View file

@ -41,7 +41,7 @@
#include "Lights.h"
#include "Credits.h"
#include "CullZones.h"
#include "TimeCycle.h"
#include "Timecycle.h"
#include "TxdStore.h"
#include "FileMgr.h"
#include "Text.h"

View file

@ -20,6 +20,11 @@ public:
m_attachment = nil;
Attach(matrix, owner);
}
CMatrix(float scale){
m_attachment = nil;
m_hasRwMatrix = false;
SetScale(scale);
}
~CMatrix(void){
if(m_hasRwMatrix && m_attachment)
RwMatrixDestroy(m_attachment);
@ -57,6 +62,21 @@ public:
if(m_attachment)
UpdateRW();
}
CMatrix& operator+=(CMatrix const &rhs){
m_matrix.right.x += rhs.m_matrix.right.x;
m_matrix.up.x += rhs.m_matrix.up.x;
m_matrix.at.x += rhs.m_matrix.at.x;
m_matrix.right.y += rhs.m_matrix.right.y;
m_matrix.up.y += rhs.m_matrix.up.y;
m_matrix.at.y += rhs.m_matrix.at.y;
m_matrix.right.z += rhs.m_matrix.right.z;
m_matrix.up.z += rhs.m_matrix.up.z;
m_matrix.at.z += rhs.m_matrix.at.z;
m_matrix.pos.x += rhs.m_matrix.pos.x;
m_matrix.pos.y += rhs.m_matrix.pos.y;
m_matrix.pos.z += rhs.m_matrix.pos.z;
return *this;
}
CVector *GetPosition(void){ return (CVector*)&m_matrix.pos; }
CVector *GetRight(void) { return (CVector*)&m_matrix.right; }
@ -182,6 +202,21 @@ public:
void CopyOnlyMatrix(CMatrix *other){
m_matrix = other->m_matrix;
}
void SetUnity(void) {
m_matrix.right.x = 1.0f;
m_matrix.right.y = 0.0f;
m_matrix.right.z = 0.0f;
m_matrix.up.x = 0.0f;
m_matrix.up.y = 1.0f;
m_matrix.up.z = 0.0f;
m_matrix.at.x = 0.0f;
m_matrix.at.y = 0.0f;
m_matrix.at.z = 1.0f;
m_matrix.pos.x = 0.0f;
m_matrix.pos.x = 0.0f;
m_matrix.pos.y = 0.0f;
m_matrix.pos.z = 0.0f;
}
};
inline CMatrix&

View file

@ -9,7 +9,7 @@
CBaseModelInfo::CBaseModelInfo(ModeInfoType type)
{
m_colModel = nil;
m_twodEffects = 0;
m_twodEffects = nil;
m_objectId = -1;
m_refCount = 0;
m_txdSlot = -1;
@ -23,7 +23,7 @@ CBaseModelInfo::Shutdown(void)
{
DeleteCollisionModel();
DeleteRwObject();
m_twodEffects = 0;
m_twodEffects = nil;
m_num2dEffects = 0;
m_txdSlot = -1;
}

View file

@ -48,7 +48,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
AddTexDictionaryRef();
RpClumpForAllAtomics(clump, SetAtomicRendererCB, nil);
if(strncmp(GetName(), "playerh", 8) == 0)
RpClumpForAllAtomics(clump, SetAtomicRendererCB, CVisibilityPlugins::RenderPlayerCB);
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
}
void

View file

@ -25,7 +25,7 @@ RwObjectNameIdAssocation CPedModelInfo::m_pPedIds[12] = {
{ "Sfootl", PED_FOOTL, 0, },
{ "Sfootr", PED_FOOTR, 0, },
{ "Slowerlegr", PED_LOWERLEGR, 0, },
{ NULL, 0, 0, },
{ nil, 0, 0, },
};
void
@ -36,7 +36,7 @@ CPedModelInfo::SetClump(RpClump *clump)
if(m_hitColModel == nil)
CreateHitColModel();
if(strncmp(GetName(), "player", 7) == 0)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, CVisibilityPlugins::RenderPlayerCB);
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
}
RpAtomic*
@ -82,8 +82,8 @@ CPedModelInfo::SetLowDetailClump(RpClump *lodclump)
RpClumpForAllAtomics(m_clump, CountAtomicsCB, &numAtm); // actually unused
RpClumpForAllAtomics(lodclump, CountAtomicsCB, &numLodAtm);
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, CVisibilityPlugins::RenderPedHiDetailCB);
RpClumpForAllAtomics(lodclump, SetAtomicRendererCB, CVisibilityPlugins::RenderPedLowDetailCB);
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPedHiDetailCB);
RpClumpForAllAtomics(lodclump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPedLowDetailCB);
pAtm = atomics;
RpClumpForAllAtomics(lodclump, GetAtomicListCB, &pAtm);
@ -112,14 +112,14 @@ struct ColNodeInfo
// TODO: find out piece types
#define NUMPEDINFONODES 8
ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = {
{ NULL, PED_HEAD, 6, 0.0f, 0.05f, 0.2f },
{ nil, PED_HEAD, 6, 0.0f, 0.05f, 0.2f },
{ "Storso", 0, 0, 0.0f, 0.15f, 0.2f },
{ "Storso", 0, 0, 0.0f, -0.05f, 0.3f },
{ NULL, PED_TORSO, 1, 0.0f, -0.07f, 0.3f },
{ NULL, PED_UPPERARML, 2, 0.07f, -0.1f, 0.2f },
{ NULL, PED_UPPERARMR, 3, -0.07f, -0.1f, 0.2f },
{ nil, PED_TORSO, 1, 0.0f, -0.07f, 0.3f },
{ nil, PED_UPPERARML, 2, 0.07f, -0.1f, 0.2f },
{ nil, PED_UPPERARMR, 3, -0.07f, -0.1f, 0.2f },
{ "Slowerlegl", 0, 4, 0.0f, 0.07f, 0.25f },
{ NULL, PED_LOWERLEGR, 5, 0.0f, 0.07f, 0.25f },
{ nil, PED_LOWERLEGR, 5, 0.0f, 0.07f, 0.25f },
};
RwObject*

View file

@ -1003,7 +1003,7 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data)
if(spec <= 0.0f)
RpMatFXMaterialSetEffects(material, rpMATFXEFFECTNULL);
else{
if(RpMaterialGetTexture(material) == 0)
if(RpMaterialGetTexture(material) == nil)
RpMaterialSetTexture(material, gpWhiteTexture);
RpMatFXMaterialSetEffects(material, rpMATFXEFFECTENVMAP);
#ifndef PS2_MATFX

View file

@ -1,6 +1,6 @@
#include <direct.h>
#include <csignal>
#include <Windows.h>
#include <windows.h>
#include "common.h"
#include "patcher.h"
#include "Renderer.h"
@ -293,7 +293,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
strcat_s(re3_buff, re3_buffsize, "(Press Retry to debug the application)");
nCode = ::MessageBoxA(NULL, re3_buff, "RE3 Assertion Failed!",
nCode = ::MessageBoxA(nil, re3_buff, "RE3 Assertion Failed!",
MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
if (nCode == IDABORT)
@ -342,7 +342,7 @@ patch()
{
StaticPatcher::Apply();
Patch<float>(0x46BC61+6, 1.0f); // car distance
// Patch<float>(0x46BC61+6, 1.0f); // car distance
InjectHook(0x59E460, printf, PATCH_JUMP);
InjectHook(0x475E00, printf, PATCH_JUMP); // _Error

View file

@ -9,7 +9,7 @@
#include "World.h"
#include "Weather.h"
#include "Collision.h"
#include "TimeCycle.h"
#include "Timecycle.h"
#include "Coronas.h"
struct FlareDef
@ -388,7 +388,7 @@ CCoronas::Render(void)
// streaks
for(i = 0; i < NUMCORONAS; i++){
if(aCoronas[i].id == 0 || !aCoronas[i].drawStreak)
break;
continue;
for(j = 0; j < 5; j++){
if(!aCoronas[i].hasValue[j] || !aCoronas[i].hasValue[j+1])

File diff suppressed because it is too large Load diff

View file

@ -107,7 +107,7 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
void
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha)
{
RwRGBA color = { red, green, blue, blur };
RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur };
if(BlurOn){
if(pFrontBuffer){
if(ms_bJustInitialised)

View file

@ -240,7 +240,7 @@ void CParticle::ReloadConfig()
for ( int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ )
{
if ( i == MAX_PARTICLES_ON_SCREEN - 1 )
gParticleArray[i].m_pNext = NULL;
gParticleArray[i].m_pNext = nil;
else
gParticleArray[i].m_pNext = &gParticleArray[i + 1];
@ -310,37 +310,37 @@ void CParticle::Initialise()
for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], NULL);
gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], nil);
gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]);
}
for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
{
gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], NULL);
gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], nil);
gpSmoke2Raster[i] = RwTextureGetRaster(gpSmoke2Tex[i]);
}
for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
gpRubberTex[i] = RwTextureRead(RubberFiles[i], NULL);
gpRubberTex[i] = RwTextureRead(RubberFiles[i], nil);
gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]);
}
for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], NULL);
gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], nil);
gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]);
}
for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], NULL);
gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], nil);
gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]);
}
for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], NULL);
gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], nil);
gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]);
}
@ -352,13 +352,13 @@ void CParticle::Initialise()
for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
{
gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], NULL);
gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], nil);
gpRainDropRaster[i] = RwTextureGetRaster(gpRainDropTex[i]);
}
for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], NULL);
gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], nil);
gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]);
}
@ -370,57 +370,57 @@ void CParticle::Initialise()
for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], NULL);
gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], nil);
gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]);
}
for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], NULL);
gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], nil);
gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]);
}
gpFlame1Tex = RwTextureRead("flame1", NULL);
gpFlame1Raster = RwTextureGetRaster(gpFlame1Tex);
gpFlame5Tex = RwTextureRead("flame5", NULL);
gpFlame5Tex = RwTextureRead("flame5", nil);
gpFlame5Raster = RwTextureGetRaster(gpFlame1Tex); // copy-paste bug ?
gpRainDropSmallTex = RwTextureRead("rainsmall", NULL);
gpRainDropSmallTex = RwTextureRead("rainsmall", nil);
gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex);
gpBloodTex = RwTextureRead("blood", NULL);
gpBloodTex = RwTextureRead("blood", nil);
gpBloodRaster = RwTextureGetRaster(gpBloodTex);
gpLeafTex = RwTextureRead("gameleaf01_64", NULL);
gpLeafTex = RwTextureRead("gameleaf01_64", nil);
gpLeafRaster = RwTextureGetRaster(gpLeafTex);
gpCloudTex1 = RwTextureRead("cloud3", NULL);
gpCloudTex1 = RwTextureRead("cloud3", nil);
gpCloudRaster1 = RwTextureGetRaster(gpCloudTex1);
gpCloudTex4 = RwTextureRead("cloudmasked", NULL);
gpCloudTex4 = RwTextureRead("cloudmasked", nil);
gpCloudRaster4 = RwTextureGetRaster(gpCloudTex4);
gpBloodSmallTex = RwTextureRead("bloodsplat2", NULL);
gpBloodSmallTex = RwTextureRead("bloodsplat2", nil);
gpBloodSmallRaster = RwTextureGetRaster(gpBloodSmallTex);
gpGungeTex = RwTextureRead("gunge", NULL);
gpGungeTex = RwTextureRead("gunge", nil);
gpGungeRaster = RwTextureGetRaster(gpGungeTex);
gpCollisionSmokeTex = RwTextureRead("collisionsmoke", NULL);
gpCollisionSmokeTex = RwTextureRead("collisionsmoke", nil);
gpCollisionSmokeRaster = RwTextureGetRaster(gpCollisionSmokeTex);
gpBulletHitTex = RwTextureRead("bullethitsmoke", NULL);
gpBulletHitTex = RwTextureRead("bullethitsmoke", nil);
gpBulletHitRaster = RwTextureGetRaster(gpBulletHitTex);
gpGunShellTex = RwTextureRead("gunshell", NULL);
gpGunShellTex = RwTextureRead("gunshell", nil);
gpGunShellRaster = RwTextureGetRaster(gpGunShellTex);
gpWakeOldTex = RwTextureRead("wake_old", NULL);
gpWakeOldTex = RwTextureRead("wake_old", nil);
gpWakeOldRaster = RwTextureGetRaster(gpWakeOldTex);
gpPointlightTex = RwTextureRead("pointlight", NULL);
gpPointlightTex = RwTextureRead("pointlight", nil);
gpPointlightRaster = RwTextureGetRaster(gpPointlightTex);
CTxdStore::PopCurrentTxd();
@ -451,7 +451,7 @@ void CParticle::Initialise()
case PARTICLE_GUNSMOKE:
case PARTICLE_SPLASH:
entry->m_ppRaster = NULL;
entry->m_ppRaster = nil;
break;
case PARTICLE_FLAME:
@ -584,7 +584,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpSmokeTex[i]);
#ifdef GTA3_1_1_PATCH
gpSmokeTex[i] = NULL;
gpSmokeTex[i] = nil;
#endif
}
@ -592,7 +592,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpSmoke2Tex[i]);
#ifdef GTA3_1_1_PATCH
gpSmoke2Tex[i] = NULL;
gpSmoke2Tex[i] = nil;
#endif
}
@ -600,7 +600,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpRubberTex[i]);
#ifdef GTA3_1_1_PATCH
gpRubberTex[i] = NULL;
gpRubberTex[i] = nil;
#endif
}
@ -608,7 +608,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpRainSplashTex[i]);
#ifdef GTA3_1_1_PATCH
gpRainSplashTex[i] = NULL;
gpRainSplashTex[i] = nil;
#endif
}
@ -616,7 +616,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpWatersprayTex[i]);
#ifdef GTA3_1_1_PATCH
gpWatersprayTex[i] = NULL;
gpWatersprayTex[i] = nil;
#endif
}
@ -624,7 +624,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpExplosionMediumTex[i]);
#ifdef GTA3_1_1_PATCH
gpExplosionMediumTex[i] = NULL;
gpExplosionMediumTex[i] = nil;
#endif
}
@ -632,7 +632,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpGunFlashTex[i]);
#ifdef GTA3_1_1_PATCH
gpGunFlashTex[i] = NULL;
gpGunFlashTex[i] = nil;
#endif
}
@ -640,7 +640,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpRainDropTex[i]);
#ifdef GTA3_1_1_PATCH
gpRainDropTex[i] = NULL;
gpRainDropTex[i] = nil;
#endif
}
@ -648,7 +648,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpRainSplashupTex[i]);
#ifdef GTA3_1_1_PATCH
gpRainSplashupTex[i] = NULL;
gpRainSplashupTex[i] = nil;
#endif
}
@ -656,7 +656,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpBirdfrontTex[i]);
#ifdef GTA3_1_1_PATCH
gpBirdfrontTex[i] = NULL;
gpBirdfrontTex[i] = nil;
#endif
}
@ -664,7 +664,7 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpCarDebrisTex[i]);
#ifdef GTA3_1_1_PATCH
gpCarDebrisTex[i] = NULL;
gpCarDebrisTex[i] = nil;
#endif
}
@ -672,78 +672,78 @@ void CParticle::Shutdown()
{
RwTextureDestroy(gpCarSplashTex[i]);
#ifdef GTA3_1_1_PATCH
gpCarSplashTex[i] = NULL;
gpCarSplashTex[i] = nil;
#endif
}
RwTextureDestroy(gpFlame1Tex);
#ifdef GTA3_1_1_PATCH
gpFlame1Tex = NULL;
gpFlame1Tex = nil;
#endif
RwTextureDestroy(gpFlame5Tex);
#ifdef GTA3_1_1_PATCH
gpFlame5Tex = NULL;
gpFlame5Tex = nil;
#endif
RwTextureDestroy(gpRainDropSmallTex);
#ifdef GTA3_1_1_PATCH
gpRainDropSmallTex = NULL;
gpRainDropSmallTex = nil;
#endif
RwTextureDestroy(gpBloodTex);
#ifdef GTA3_1_1_PATCH
gpBloodTex = NULL;
gpBloodTex = nil;
#endif
RwTextureDestroy(gpLeafTex);
#ifdef GTA3_1_1_PATCH
gpLeafTex = NULL;
gpLeafTex = nil;
#endif
RwTextureDestroy(gpCloudTex1);
#ifdef GTA3_1_1_PATCH
gpCloudTex1 = NULL;
gpCloudTex1 = nil;
#endif
RwTextureDestroy(gpCloudTex4);
#ifdef GTA3_1_1_PATCH
gpCloudTex4 = NULL;
gpCloudTex4 = nil;
#endif
RwTextureDestroy(gpBloodSmallTex);
#ifdef GTA3_1_1_PATCH
gpBloodSmallTex = NULL;
gpBloodSmallTex = nil;
#endif
RwTextureDestroy(gpGungeTex);
#ifdef GTA3_1_1_PATCH
gpGungeTex = NULL;
gpGungeTex = nil;
#endif
RwTextureDestroy(gpCollisionSmokeTex);
#ifdef GTA3_1_1_PATCH
gpCollisionSmokeTex = NULL;
gpCollisionSmokeTex = nil;
#endif
RwTextureDestroy(gpBulletHitTex);
#ifdef GTA3_1_1_PATCH
gpBulletHitTex = NULL;
gpBulletHitTex = nil;
#endif
RwTextureDestroy(gpGunShellTex);
#ifdef GTA3_1_1_PATCH
gpGunShellTex = NULL;
gpGunShellTex = nil;
#endif
RwTextureDestroy(gpWakeOldTex);
#ifdef GTA3_1_1_PATCH
gpWakeOldTex = NULL;
gpWakeOldTex = nil;
#endif
RwTextureDestroy(gpPointlightTex);
#ifdef GTA3_1_1_PATCH
gpPointlightTex = NULL;
gpPointlightTex = nil;
#endif
int32 slot;
@ -775,18 +775,18 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
|| type == PARTICLE_CARCOLLISION_DUST )
&& nParticleCreationInterval & CTimer::GetFrameCounter() )
{
return NULL;
return nil;
}
CParticle *pParticle = m_pUnusedListHead;
if ( pParticle == NULL )
return NULL;
if ( pParticle == nil )
return nil;
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[type];
if ( psystem->m_fCreateRange != 0.0f && psystem->m_fCreateRange < ( TheCamera.GetPosition() - vecPos ).MagnitudeSqr() )
return NULL;
return nil;
pParticle->m_fSize = psystem->m_fDefaultInitialRadius;
@ -918,13 +918,13 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( !CWorld::ProcessVerticalLine(
pParticle->m_vecPosition + CVector(0.0f, 0.0f, 0.5f),
-100.0f, point, entity, true, true, false, false, true, false, NULL) )
-100.0f, point, entity, true, true, false, false, true, false, nil) )
{
return NULL;
return nil;
}
if ( point.point.z >= pParticle->m_vecPosition.z )
return NULL;
return nil;
pParticle->m_fZGround = point.point.z;
bValidGroundFound = true;
@ -944,7 +944,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
Z_Ground = CWorld::FindGroundZFor3DCoord(vecPos.x, vecPos.y, vecPos.z, (bool *)&bZFound);
if ( bZFound == false )
return NULL;
return nil;
pParticle->m_fZGround = Z_Ground;
}
@ -1009,13 +1009,13 @@ void CParticle::Update()
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
CParticle *particle = psystem->m_pParticles;
CParticle *prevParticle = NULL;
CParticle *prevParticle = nil;
bool bRemoveParticle;
if ( particle == NULL )
if ( particle == nil )
continue;
for ( ; particle != NULL; _Next(particle, prevParticle, psystem, bRemoveParticle) )
for ( ; particle != nil; _Next(particle, prevParticle, psystem, bRemoveParticle) )
{
bRemoveParticle = false;
@ -1121,7 +1121,7 @@ void CParticle::Update()
particle->m_vecPosition.y,
0.05f + particle->m_fZGround
),
CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0);
CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0);
}
else
{
@ -1132,7 +1132,7 @@ void CParticle::Update()
particle->m_vecPosition.y,
0.05f + particle->m_fZGround
),
CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0);
CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0);
}
continue;
@ -1156,7 +1156,7 @@ void CParticle::Update()
particle->m_vecPosition.y,
0.05f + particle->m_fZGround
),
CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0);
CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0);
}
else
{
@ -1167,7 +1167,7 @@ void CParticle::Update()
particle->m_vecPosition.y,
0.05f + particle->m_fZGround
),
CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0);
CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0);
}
}
@ -1218,7 +1218,7 @@ void CParticle::Update()
CEntity *entity;
if ( CWorld::ProcessVerticalLine(particle->m_vecPosition, moveStep.z, point, entity,
true, true, false, false, true, false, NULL) )
true, true, false, false, true, false, nil) )
{
if ( moveStep.z <= point.point.z )
{
@ -1258,7 +1258,7 @@ void CParticle::Update()
CGeneral::GetRandomNumberInRange(-0.02f, 0.02f),
CGeneral::GetRandomNumberInRange(0.05f, 0.1f)
),
NULL,
nil,
particle->m_fSize, color, particle->m_nRotationStep, 0, 0, 0);
PlayOneShotScriptObject(_SOUND_BULLET_SHELL_HIT_GROUND_1, particle->m_vecPosition);
@ -1277,7 +1277,7 @@ void CParticle::Update()
0.05f + particle->m_fZGround
),
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.03f, 0.06f)),
NULL,
nil,
particle->m_fSize, color, 0, 0, 0, 0);
PlayOneShotScriptObject(_SOUND_BULLET_SHELL_HIT_GROUND_2, particle->m_vecPosition);
@ -1309,7 +1309,7 @@ void CParticle::Update()
CEntity *entity;
if ( CWorld::ProcessVerticalLine(particle->m_vecPosition, moveStep.z, point, entity,
true, false, false, false, true, false, NULL) )
true, false, false, false, true, false, nil) )
{
if ( moveStep.z <= point.point.z )
{
@ -1317,7 +1317,7 @@ void CParticle::Update()
if ( psystem->m_Type == PARTICLE_HELI_ATTACK )
{
bRemoveParticle = true;
AddParticle(PARTICLE_STEAM, moveStep, CVector(0.0f, 0.0f, 0.05f), NULL, 0.2f, 0, 0, 0, 0);
AddParticle(PARTICLE_STEAM, moveStep, CVector(0.0f, 0.0f, 0.05f), nil, 0.2f, 0, 0, 0, 0);
continue;
}
}
@ -1444,7 +1444,7 @@ void CParticle::Render()
uint32 flags = DRAW_OPAQUE;
RwRaster *prevFrame = NULL;
RwRaster *prevFrame = nil;
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
@ -1495,7 +1495,7 @@ void CParticle::Render()
flags = psystem->Flags;
}
if ( frames != NULL )
if ( frames != nil )
{
RwRaster *curFrame = *frames;
if ( curFrame != prevFrame )
@ -1507,14 +1507,14 @@ void CParticle::Render()
}
}
while ( particle != NULL )
while ( particle != nil )
{
bool canDraw = true;
if ( particle->m_nAlpha == 0 )
canDraw = false;
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != NULL )
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil )
{
RwRaster *curFrame = frames[particle->m_nCurrentFrame];
if ( prevFrame != curFrame )
@ -1754,7 +1754,7 @@ void CParticle::RemovePSystem(tParticleType type)
tParticleSystemData *psystemdata = &mod_ParticleSystemManager.m_aParticles[type];
for ( CParticle *particle = psystemdata->m_pParticles; particle; particle = psystemdata->m_pParticles )
RemoveParticle(particle, NULL, psystemdata);
RemoveParticle(particle, nil, psystemdata);
}
void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData)
@ -1796,7 +1796,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize
CGeneral::GetRandomNumberInRange(-0.2f, 0.2f),
CGeneral::GetRandomNumberInRange(-0.2f, 0.0f)
),
NULL,
nil,
fSize, color, 0, 0, 0, 0);
AddParticle(PARTICLE_EXPLOSION_MFAST,
@ -1807,7 +1807,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize
CGeneral::GetRandomNumberInRange(-0.04f, 0.04f),
CGeneral::GetRandomNumberInRange(0.0f, 0.07f)
),
NULL,
nil,
fSize, color, 0, 0, 0, 0);
AddParticle(PARTICLE_EXPLOSION_MFAST,
@ -1818,7 +1818,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize
CGeneral::GetRandomNumberInRange(-0.04f, 0.04f),
CGeneral::GetRandomNumberInRange(0.0f, 0.07f)
),
NULL,
nil,
fSize, color, 0, 0, 0, 0);
vecStepPos += vecRandOffset;
@ -1843,7 +1843,7 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr
AddParticle(PARTICLE_CARCOLLISION_DUST,
pos,
CVector(0.0f, 0.0f, 0.0f),
NULL,
nil,
0.3f, color, 0, 0, 0, 0);
}
}

View file

@ -65,7 +65,7 @@ public:
static void Initialise();
static void Shutdown();
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = nil, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static void Update();

View file

@ -19,7 +19,7 @@ void cParticleSystemMgr::Initialise()
LoadParticleData();
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
m_aParticles[i].m_pParticles = NULL;
m_aParticles[i].m_pParticles = nil;
}
void cParticleSystemMgr::LoadParticleData()
@ -28,7 +28,7 @@ void cParticleSystemMgr::LoadParticleData()
CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
CFileMgr::SetDir("");
tParticleSystemData *entry = NULL;
tParticleSystemData *entry = nil;
int32 type = PARTICLE_FIRST;
char *lineStart = (char *)work_buff;
@ -39,8 +39,8 @@ void cParticleSystemMgr::LoadParticleData()
while ( true )
{
ASSERT(lineStart != NULL);
ASSERT(lineEnd != NULL);
ASSERT(lineStart != nil);
ASSERT(lineEnd != nil);
while ( *lineEnd != '\n' )
++lineEnd;
@ -64,7 +64,7 @@ void cParticleSystemMgr::LoadParticleData()
char *value = strtok(line, delims);
ASSERT(value != NULL);
ASSERT(value != nil);
do
{
@ -73,7 +73,7 @@ void cParticleSystemMgr::LoadParticleData()
case CFG_PARAM_PARTICLE_TYPE_NAME:
ASSERT(type < MAX_PARTICLES);
entry = &m_aParticles[type];
ASSERT(entry != NULL);
ASSERT(entry != nil);
entry->m_Type = (tParticleType)type++;
strcpy(entry->m_aName, value);
break;
@ -227,14 +227,14 @@ void cParticleSystemMgr::LoadParticleData()
break;
}
value = strtok(NULL, delims);
value = strtok(nil, delims);
param++;
if ( param > CFG_PARAM_LAST )
param = CFG_PARAM_FIRST;
} while ( value != NULL );
} while ( value != nil );
}
lineEnd++;

View file

@ -303,12 +303,12 @@ RsRwInitialise(void *displayID)
/*
* Initialize debug message handling...
*/
RsEventHandler(rsINITDEBUG, NULL);
RsEventHandler(rsINITDEBUG, nil);
/*
* Attach all plugins...
*/
if (RsEventHandler(rsPLUGINATTACH, NULL) == rsEVENTERROR)
if (RsEventHandler(rsPLUGINATTACH, nil) == rsEVENTERROR)
{
return (FALSE);
}
@ -316,7 +316,7 @@ RsRwInitialise(void *displayID)
/*
* Attach input devices...
*/
if (RsEventHandler(rsINPUTDEVICEATTACH, NULL) == rsEVENTERROR)
if (RsEventHandler(rsINPUTDEVICEATTACH, nil) == rsEVENTERROR)
{
return (FALSE);
}
@ -346,7 +346,7 @@ RsRwInitialise(void *displayID)
/*
* Register loaders for an image with a particular file extension...
*/
RsEventHandler(rsREGISTERIMAGELOADER, NULL);
RsEventHandler(rsREGISTERIMAGELOADER, nil);
psNativeTextureSupport();
@ -390,17 +390,17 @@ RsInitialise(void)
/* setup the keyboard */
RsGlobal.keyboard.inputDeviceType = rsKEYBOARD;
RsGlobal.keyboard.inputEventHandler = 0;
RsGlobal.keyboard.inputEventHandler = nil;
RsGlobal.keyboard.used = FALSE;
/* setup the mouse */
RsGlobal.mouse.inputDeviceType = rsMOUSE;
RsGlobal.mouse.inputEventHandler = 0;
RsGlobal.mouse.inputEventHandler = nil;
RsGlobal.mouse.used = FALSE;
/* setup the pad */
RsGlobal.pad.inputDeviceType = rsPAD;
RsGlobal.pad.inputEventHandler = 0;
RsGlobal.pad.inputEventHandler = nil;
RsGlobal.pad.used = FALSE;
result = psInitialise();

View file

@ -93,16 +93,16 @@ static psGlobalType &PsGlobal = *(psGlobalType*)0x72CF60;
#include "Frontend.h"
#include "Game.h"
#include "PCSave.h"
#include "Sprite2D.h"
#include "Sprite2d.h"
VALIDATE_SIZE(psGlobalType, 0x28);
// DirectShow interfaces
IGraphBuilder *pGB = NULL;
IMediaControl *pMC = NULL;
IMediaEventEx *pME = NULL;
IVideoWindow *pVW = NULL;
IMediaSeeking *pMS = NULL;
IGraphBuilder *pGB = nil;
IMediaControl *pMC = nil;
IMediaEventEx *pME = nil;
IVideoWindow *pVW = nil;
IMediaSeeking *pMS = nil;
DWORD dwDXVersion;
DWORD _dwMemTotalPhys;
@ -169,13 +169,13 @@ void _psCreateFolder(LPCSTR path)
{
HANDLE hfle = CreateFile(path, GENERIC_READ,
FILE_SHARE_READ,
NULL,
nil,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_NORMAL,
NULL);
nil);
if ( hfle == INVALID_HANDLE_VALUE )
CreateDirectory(path, NULL);
CreateDirectory(path, nil);
else
CloseHandle(hfle);
}
@ -304,7 +304,7 @@ psMouseSetPos(RwV2d *pos)
RwMemoryFunctions*
psGetMemoryFunctions(void)
{
return 0;
return nil;
}
/*
@ -344,9 +344,9 @@ InitApplication(HANDLE instance)
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = (HINSTANCE)instance;
windowClass.hIcon = NULL;
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hbrBackground = NULL;
windowClass.hIcon = nil;
windowClass.hCursor = LoadCursor(nil, IDC_ARROW);
windowClass.hbrBackground = nil;
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = AppClassName;
@ -382,7 +382,7 @@ InitInstance(HANDLE instance)
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
rect.right - rect.left, rect.bottom - rect.top,
(HWND)NULL, (HMENU)NULL, (HINSTANCE)instance, NULL);
(HWND)nil, (HMENU)nil, (HINSTANCE)instance, nil);
}
void _GetVideoMemInfo(LPDWORD total, LPDWORD avaible)
@ -390,7 +390,7 @@ void _GetVideoMemInfo(LPDWORD total, LPDWORD avaible)
HRESULT hr;
LPDIRECTDRAW7 pDD7;
hr = DirectDrawCreateEx(NULL, (VOID**)&pDD7, IID_IDirectDraw7, NULL);
hr = DirectDrawCreateEx(nil, (VOID**)&pDD7, IID_IDirectDraw7, nil);
if ( FAILED(hr) )
return;
@ -430,15 +430,15 @@ typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* )
DWORD GetDXVersion()
{
DIRECTDRAWCREATEEX DirectDrawCreateEx = NULL;
HINSTANCE hDDrawDLL = NULL;
HINSTANCE hD3D8DLL = NULL;
HINSTANCE hDDrawDLL = nil;
HINSTANCE hD3D8DLL = nil;
HINSTANCE hDPNHPASTDLL = NULL;
DWORD dwDXVersion = 0;
//HRESULT hr;
// First see if DDRAW.DLL even exists.
hDDrawDLL = LoadLibrary( "DDRAW.DLL" );
if( hDDrawDLL == NULL )
if( hDDrawDLL == nil )
{
dwDXVersion = 0;
OutputDebugString( "Couldn't LoadLibrary DDraw\r\n" );
@ -454,15 +454,15 @@ DWORD GetDXVersion()
LPDIRECTDRAW7 pDD7;
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress( hDDrawDLL,
"DirectDrawCreateEx" );
if( NULL == DirectDrawCreateEx )
if( nil == DirectDrawCreateEx )
{
FreeLibrary( hDDrawDLL );
OutputDebugString( "Couldn't GetProcAddress DirectDrawCreateEx\r\n" );
return dwDXVersion;
}
if( FAILED( DirectDrawCreateEx( NULL, (VOID**)&pDD7, IID_IDirectDraw7,
NULL ) ) )
if( FAILED( DirectDrawCreateEx( nil, (VOID**)&pDD7, IID_IDirectDraw7,
nil ) ) )
{
FreeLibrary( hDDrawDLL );
OutputDebugString( "Couldn't DirectDrawCreateEx\r\n" );
@ -480,7 +480,7 @@ DWORD GetDXVersion()
// Simply see if D3D8.dll exists.
hD3D8DLL = LoadLibrary( "D3D8.DLL" );
if( hD3D8DLL == NULL )
if( hD3D8DLL == nil )
{
FreeLibrary( hDDrawDLL );
OutputDebugString( "Couldn't LoadLibrary D3D8.DLL\r\n" );
@ -497,7 +497,7 @@ DWORD GetDXVersion()
// Simply see if dpnhpast.dll exists.
hDPNHPASTDLL = LoadLibrary( "dpnhpast.dll" );
if( hDPNHPASTDLL == NULL )
if( hDPNHPASTDLL == nil )
{
FreeLibrary( hDPNHPASTDLL );
OutputDebugString( "Couldn't LoadLibrary dpnhpast.dll\r\n" );
@ -617,10 +617,10 @@ psInitialise(void)
PsGlobal.fullScreen = FALSE;
PsGlobal.dinterface = NULL;
PsGlobal.mouse = NULL;
PsGlobal.joy1 = NULL;
PsGlobal.joy2 = NULL;
PsGlobal.dinterface = nil;
PsGlobal.mouse = nil;
PsGlobal.joy1 = nil;
PsGlobal.joy2 = nil;
CFileMgr::Initialise();
@ -681,7 +681,7 @@ psInitialise(void)
if ( _dwOperatingSystemVersion == OS_WIN95 )
{
MessageBoxW(NULL,
MessageBoxW(nil,
(LPCWSTR)TheText.Get("WIN_95"), // Grand Theft Auto III cannot run on Windows 95
(LPCWSTR)TheText.Get("WIN_TTL"), // Grand Theft Auto III
MB_OK);
@ -691,7 +691,7 @@ psInitialise(void)
if ( dwDXVersion < 0x801 )
{
MessageBoxW(NULL,
MessageBoxW(nil,
(LPCWSTR)TheText.Get("WIN_DX"), // Grand Theft Auto III requires at least DirectX version 8.1
(LPCWSTR)TheText.Get("WIN_TTL"), // Grand Theft Auto III
MB_OK);
@ -716,7 +716,7 @@ psInitialise(void)
if ( _dwMemAvailVideo < (12 * 1024 * 1024) /*12 MB*/ )
{
MessageBoxW(NULL,
MessageBoxW(nil,
(LPCWSTR)TheText.Get("WIN_VDM"), // Grand Theft Auto III requires at least 12MB of available video memory
(LPCWSTR)TheText.Get("WIN_TTL"), // Grand Theft Auto III
MB_OK);
@ -759,7 +759,7 @@ RwBool _psFreeVideoModeList()
numModes = _psGetNumVideModes();
if ( _VMList == NULL )
if ( _VMList == nil )
return TRUE;
for ( i = 0; i < numModes; i++ )
@ -769,7 +769,7 @@ RwBool _psFreeVideoModeList()
RwFree(_VMList);
_VMList = NULL;
_VMList = nil;
return TRUE;
}
@ -782,7 +782,7 @@ RwChar **_psGetVideoModeList()
RwInt32 numModes;
RwInt32 i;
if ( _VMList != NULL )
if ( _VMList != nil )
{
return _VMList;
}
@ -810,10 +810,10 @@ RwChar **_psGetVideoModeList()
rwsprintf(_VMList[i],"%lu X %lu X %lu", vm.width, vm.height, vm.depth);
}
else
_VMList[i] = NULL;
_VMList[i] = nil;
}
else
_VMList[i] = NULL;
_VMList[i] = nil;
}
return _VMList;
@ -824,7 +824,7 @@ RwChar **_psGetVideoModeList()
*/
void _psSelectScreenVM(RwInt32 videoMode)
{
RwTexDictionarySetCurrent( NULL );
RwTexDictionarySetCurrent( nil );
FrontEndMenuManager.UnloadTextures();
@ -834,7 +834,7 @@ void _psSelectScreenVM(RwInt32 videoMode)
ShowWindow(PSGLOBAL(window), SW_HIDE);
MessageBoxW(NULL,
MessageBoxW(nil,
(LPCWSTR)TheText.Get("WIN_RSZ"), // Failed to select new screen resolution
(LPCWSTR)TheText.Get("WIN_TTL"), // Grand Theft Auto III
MB_OK);
@ -850,7 +850,7 @@ void WaitForState(FILTER_STATE State)
{
HRESULT hr;
ASSERT(pMC != NULL);
ASSERT(pMC != nil);
// Make sure we have switched to the required state
LONG lfs;
@ -868,7 +868,7 @@ void HandleGraphEvent(void)
LONG evCode, evParam1, evParam2;
HRESULT hr=S_OK;
ASSERT(pME != NULL);
ASSERT(pME != nil);
// Process all queued events
while (SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR *)&evParam1,
@ -922,7 +922,7 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
{
ShowCursor(FALSE);
SetCursor(NULL);
SetCursor(nil);
break; // is this correct ?
}
@ -1111,14 +1111,14 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
case GS_LOGO_MPEG:
case GS_INTRO_MPEG:
{
ASSERT(pMC != NULL);
ASSERT(pMC != nil);
LONG state;
pMC->GetState(10, &state);
if ( !(BOOL)wParam ) // losing activation
{
if ( state == State_Running && pMC != NULL )
if ( state == State_Running && pMC != nil )
{
HRESULT hr = pMC->Pause();
@ -1132,7 +1132,7 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
{
CenterVideo();
if ( state != State_Running && pMC != NULL )
if ( state != State_Running && pMC != nil )
{
HRESULT hr = pMC->Run();
@ -1183,7 +1183,7 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
/*
* Quit message handling.
*/
ClipCursor(NULL);
ClipCursor(nil);
_InputShutdown();
@ -1260,7 +1260,7 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
{
LPDIRECT3D8 d3d = Direct3DCreate8(D3D_SDK_VERSION);
ASSERT(d3d != NULL);
ASSERT(d3d != nil);
INT refreshRate = -1;
D3DFORMAT format;
@ -1367,7 +1367,7 @@ psSelectDevice()
if ( !modeFound )
{
MessageBox(NULL, "Cannot find 640x480 video mode", "GTA3", MB_OK);
MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK);
return FALSE;
}
}
@ -1417,7 +1417,7 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
{
RwInitialised = FALSE;
RsEventHandler(rsRWTERMINATE, NULL);
RsEventHandler(rsRWTERMINATE, nil);
GcurSel = subSystem;
GcurSelVM = videoMode;
@ -1544,11 +1544,11 @@ void InitialiseLanguage()
#pragma warning( disable : 4302)
WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID());
WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID());
WORD primLayout = PRIMARYLANGID(GetKeyboardLayout(0));
WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0));
WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID());
WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID());
WORD subLayout = SUBLANGID(GetKeyboardLayout(0));
WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0));
#pragma warning( pop )
if ( primUserLCID == LANG_GERMAN
@ -1648,7 +1648,7 @@ void CenterVideo(void)
HRESULT hr = S_OK;
RECT rect;
ASSERT(pVW != NULL);
ASSERT(pVW != nil);
GetClientRect(PSGLOBAL(window), &rect);
@ -1674,16 +1674,16 @@ void PlayMovieInWindow(int cmdShow, LPTSTR szFile)
MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1);
// Initialize COM
JIF(CoInitialize(NULL));
JIF(CoInitialize(nil));
// Get the interface for DirectShow's GraphBuilder
JIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGB));
if(SUCCEEDED(hr))
{
// Have the graph builder construct its the appropriate graph automatically
JIF(pGB->RenderFile(&wFileName[0], NULL));
JIF(pGB->RenderFile(&wFileName[0], nil));
// QueryInterface for DirectShow interfaces
JIF(pGB->QueryInterface(IID_IMediaControl, (void **)&pMC));
@ -1707,10 +1707,10 @@ void PlayMovieInWindow(int cmdShow, LPTSTR szFile)
SetFocus(PSGLOBAL(window));
}
ASSERT(pGB != NULL);
ASSERT(pVW != NULL);
ASSERT(pME != NULL);
ASSERT(pMC != NULL);
ASSERT(pGB != nil);
ASSERT(pVW != nil);
ASSERT(pME != nil);
ASSERT(pMC != nil);
if(FAILED(hr))
CloseClip();
@ -1750,7 +1750,7 @@ void CloseClip(void)
void HandleExit()
{
MSG message;
while ( PeekMessage(&message, NULL, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
while ( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{
if( message.message == WM_QUIT )
{
@ -1778,13 +1778,13 @@ _WinMain(HINSTANCE instance,
RwInt32 argc, i;
RwChar **argv;
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE);
/*
* Initialize the platform independent data.
* This will in turn initialize the platform specific data...
*/
if( RsEventHandler(rsINITIALISE, NULL) == rsEVENTERROR )
if( RsEventHandler(rsINITIALISE, nil) == rsEVENTERROR )
{
return FALSE;
}
@ -1822,7 +1822,7 @@ _WinMain(HINSTANCE instance,
* Create the window...
*/
PSGLOBAL(window) = InitInstance(instance);
if( PSGLOBAL(window) == NULL )
if( PSGLOBAL(window) == nil )
{
return FALSE;
}
@ -1841,7 +1841,7 @@ _WinMain(HINSTANCE instance,
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
SetWindowLong(PSGLOBAL(window), GWL_STYLE, WS_POPUP);
SetWindowPos(PSGLOBAL(window), 0, 0, 0, 0, 0,
SetWindowPos(PSGLOBAL(window), nil, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|
SWP_FRAMECHANGED);
@ -1852,7 +1852,7 @@ _WinMain(HINSTANCE instance,
{
DestroyWindow(PSGLOBAL(window));
RsEventHandler(rsTERMINATE, NULL);
RsEventHandler(rsTERMINATE, nil);
return FALSE;
}
@ -1880,9 +1880,9 @@ _WinMain(HINSTANCE instance,
RsEventHandler(rsCAMERASIZE, &r);
}
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, FALSE, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE, FALSE, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, nil, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, FALSE, nil, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE, FALSE, nil, SPIF_SENDCHANGE);
STICKYKEYS SavedStickyKeys;
@ -1924,7 +1924,7 @@ _WinMain(HINSTANCE instance,
gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND");
LoadingScreen(NULL, NULL, "loadsc0");
LoadingScreen(nil, nil, "loadsc0");
if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE;
#endif
@ -1951,7 +1951,7 @@ _WinMain(HINSTANCE instance,
while( !RsGlobal.quit && !FrontEndMenuManager.m_bStartGameLoading )
{
if( PeekMessage(&message, NULL, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{
if( message.message == WM_QUIT )
{
@ -2044,7 +2044,7 @@ _WinMain(HINSTANCE instance,
CloseClip();
CoUninitialize();
LoadingScreen(NULL, NULL, "loadsc0");
LoadingScreen(nil, nil, "loadsc0");
if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE;
@ -2056,7 +2056,7 @@ _WinMain(HINSTANCE instance,
case GS_INIT_FRONTEND:
{
LoadingScreen(NULL, NULL, "loadsc0");
LoadingScreen(nil, nil, "loadsc0");
FrontEndMenuManager.m_bGameNotLoaded = true;
@ -2079,7 +2079,7 @@ _WinMain(HINSTANCE instance,
GetWindowPlacement(PSGLOBAL(window), &wp);
if ( wp.showCmd != SW_SHOWMINIMIZED )
RsEventHandler(rsFRONTENDIDLE, NULL);
RsEventHandler(rsFRONTENDIDLE, nil);
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bLoadingSavedGame )
{
@ -2191,7 +2191,7 @@ _WinMain(HINSTANCE instance,
/*
* Tidy up the 3D (RenderWare) components of the application...
*/
RsEventHandler(rsRWTERMINATE, NULL);
RsEventHandler(rsRWTERMINATE, nil);
/*
* Kill the window...
@ -2201,7 +2201,7 @@ _WinMain(HINSTANCE instance,
/*
* Free the platform dependent data...
*/
RsEventHandler(rsTERMINATE, NULL);
RsEventHandler(rsTERMINATE, nil);
/*
* Free the argv strings...
@ -2211,9 +2211,9 @@ _WinMain(HINSTANCE instance,
ShowCursor(TRUE);
SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &SavedStickyKeys, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, TRUE, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE, TRUE, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, TRUE, nil, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE, TRUE, nil, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, nil, SPIF_SENDCHANGE);
SetErrorMode(0);
@ -2233,8 +2233,8 @@ HRESULT _InputInitialise()
HRESULT hr;
// Create a DInput object
if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION,
IID_IDirectInput8, (VOID**)&PSGLOBAL(dinterface), NULL ) ) )
if( FAILED( hr = DirectInput8Create( GetModuleHandle(nil), DIRECTINPUT_VERSION,
IID_IDirectInput8, (VOID**)&PSGLOBAL(dinterface), nil ) ) )
return hr;
return S_OK;
@ -2245,7 +2245,7 @@ HRESULT _InputInitialiseMouse()
HRESULT hr;
// Obtain an interface to the system mouse device.
if( FAILED( hr = PSGLOBAL(dinterface)->CreateDevice( GUID_SysMouse, &PSGLOBAL(mouse), NULL ) ) )
if( FAILED( hr = PSGLOBAL(dinterface)->CreateDevice( GUID_SysMouse, &PSGLOBAL(mouse), nil ) ) )
return hr;
// Set the data format to "mouse format" - a predefined data format
@ -2277,11 +2277,11 @@ HRESULT CapturePad(RwInt32 padID)
{
HRESULT hr;
DIJOYSTATE2 js;
LPDIRECTINPUTDEVICE8 pPad = NULL;
LPDIRECTINPUTDEVICE8 pPad = nil;
pPad = ( padID == 0 ) ? PSGLOBAL(joy1) : PSGLOBAL(joy2);
if ( NULL == pPad )
if ( nil == pPad )
return S_OK;
// Poll the device to read the current state
@ -2331,7 +2331,7 @@ HRESULT CapturePad(RwInt32 padID)
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
bool deviceAvailable = pPad != NULL;
bool deviceAvailable = pPad != nil;
if ( deviceAvailable )
{
@ -2393,7 +2393,7 @@ void _InputInitialiseJoys()
_InputAddJoys();
if ( PSGLOBAL(joy1) != NULL )
if ( PSGLOBAL(joy1) != nil )
{
devCaps.dwSize = sizeof(DIDEVCAPS);
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
@ -2411,7 +2411,7 @@ void _InputInitialiseJoys()
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
}
if ( PSGLOBAL(joy2) != NULL )
if ( PSGLOBAL(joy2) != nil )
{
PSGLOBAL(joy2)->GetProperty(DIPROP_VIDPID, (LPDIPROPHEADER)&prop);
AllValidWinJoys.m_aJoys[1].m_nVendorID = LOWORD(prop.dwData);
@ -2440,7 +2440,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
// get the info about the object from the device
range.diph.dwObj = DIJOFS_X;
if ( lpDevice != NULL )
if ( lpDevice != nil )
{
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_X, DIPH_BYOFFSET ) ) )
{
@ -2452,7 +2452,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
}
range.diph.dwObj = DIJOFS_Y;
if ( lpDevice != NULL )
if ( lpDevice != nil )
{
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Y, DIPH_BYOFFSET ) ) )
{
@ -2464,7 +2464,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
}
range.diph.dwObj = DIJOFS_Z;
if ( lpDevice != NULL )
if ( lpDevice != nil )
{
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Z, DIPH_BYOFFSET ) ) )
{
@ -2476,7 +2476,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
}
range.diph.dwObj = DIJOFS_RZ;
if ( lpDevice != NULL )
if ( lpDevice != nil )
{
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_RZ, DIPH_BYOFFSET ) ) )
{
@ -2495,17 +2495,17 @@ HRESULT _InputAddJoys()
{
HRESULT hr;
hr = PSGLOBAL(dinterface)->EnumDevices(DI8DEVCLASS_GAMECTRL, _InputEnumDevicesCallback, NULL, DIEDFL_ATTACHEDONLY );
hr = PSGLOBAL(dinterface)->EnumDevices(DI8DEVCLASS_GAMECTRL, _InputEnumDevicesCallback, nil, DIEDFL_ATTACHEDONLY );
if( FAILED(hr) )
return hr;
if ( PSGLOBAL(joy1) == NULL )
if ( PSGLOBAL(joy1) == nil )
return S_FALSE;
_InputAddJoyStick(PSGLOBAL(joy1), 0);
if ( PSGLOBAL(joy2) == NULL )
if ( PSGLOBAL(joy2) == nil )
return S_OK; // we have one device already so return OK and ignore second
_InputAddJoyStick(PSGLOBAL(joy2), 1);
@ -2517,7 +2517,7 @@ HRESULT _InputGetMouseState(DIMOUSESTATE2 *state)
{
HRESULT hr;
if ( PSGLOBAL(mouse) == NULL )
if ( PSGLOBAL(mouse) == nil )
return S_FALSE;
// Get the input's device state, and put the state in dims
@ -2557,7 +2557,7 @@ BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, V
static INT Count = 0;
LPDIRECTINPUTDEVICE8 pJoystick = NULL;
LPDIRECTINPUTDEVICE8 pJoystick = nil;
if ( Count == 0 )
pJoystick = PSGLOBAL(joy1);
@ -2565,7 +2565,7 @@ BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, V
pJoystick = PSGLOBAL(joy2);
// Obtain an interface to the enumerated joystick.
hr = PSGLOBAL(dinterface)->CreateDevice( pdidInstance->guidInstance, &pJoystick, NULL );
hr = PSGLOBAL(dinterface)->CreateDevice( pdidInstance->guidInstance, &pJoystick, nil );
// If it failed, then we can't use this joystick. (Maybe the user unplugged
// it while we were in the middle of enumerating it.)

View file

@ -60,7 +60,7 @@ public:
return (T*)&m_entries[m_allocPtr];
}
T *New(int handle){
T *entry = (T*)m_entries[handle>>8];
T *entry = (T*)&m_entries[handle>>8];
SetNotFreeAt(handle);
return entry;
}