From 2115faec3867ada3a07aa7900ea0a871529343f3 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 30 Jun 2019 12:53:39 +0200 Subject: [PATCH] Cleanup project a bit --- dxsdk/Include/control.h | 1 - dxsdk/Include/errors.h | 2 +- dxsdk/Include/strmif.h | 1 - src/Camera.cpp | 4 +- src/Camera.h | 1 - src/CdStream.cpp | 90 ++++++------- src/FileLoader.cpp | 10 +- src/Pad.cpp | 12 +- src/Placeable.h | 6 +- src/Radar.cpp | 2 +- src/RwHelper.cpp | 16 +-- src/RwMatFX.cpp | 2 +- src/Streaming.h | 2 + src/Timer.cpp | 2 +- src/TxdStore.cpp | 2 +- src/animation/AnimBlendHierarchy.cpp | 2 +- src/animation/RpAnimBlend.cpp | 2 +- src/audio/MusicManager.cpp | 4 +- src/common.h | 9 +- src/control/PedPlacement.cpp | 4 +- src/debugmenu_public.h | 4 +- src/entities/CutsceneObject.cpp | 4 +- src/entities/Ped.cpp | 16 +-- src/main.cpp | 2 +- src/modelinfo/BaseModelInfo.cpp | 4 +- src/modelinfo/ClumpModelInfo.cpp | 2 +- src/modelinfo/PedModelInfo.cpp | 18 +-- src/modelinfo/VehicleModelInfo.cpp | 2 +- src/re3.cpp | 4 +- src/render/Coronas.cpp | 2 +- src/render/Hud.cpp | 22 ++-- src/render/MBlur.cpp | 2 +- src/render/Particle.cpp | 160 +++++++++++------------ src/render/Particle.h | 2 +- src/render/ParticleMgr.cpp | 16 +-- src/skel/skeleton.cpp | 14 +- src/skel/win/win.cpp | 188 +++++++++++++-------------- 37 files changed, 319 insertions(+), 317 deletions(-) diff --git a/dxsdk/Include/control.h b/dxsdk/Include/control.h index caf33d5a..906fbc4f 100644 --- a/dxsdk/Include/control.h +++ b/dxsdk/Include/control.h @@ -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 * ); diff --git a/dxsdk/Include/errors.h b/dxsdk/Include/errors.h index d89a0a1f..cee756fb 100644 --- a/dxsdk/Include/errors.h +++ b/dxsdk/Include/errors.h @@ -24,7 +24,7 @@ extern "C" { #define VFW_FIRST_CODE 0x200 #define MAX_ERROR_TEXT_LEN 160 -#include // includes all message definitions +#include // includes all message definitions typedef BOOL (WINAPI* AMGETERRORTEXTPROCA)(HRESULT, char *, DWORD); typedef BOOL (WINAPI* AMGETERRORTEXTPROCW)(HRESULT, WCHAR *, DWORD); diff --git a/dxsdk/Include/strmif.h b/dxsdk/Include/strmif.h index 0f8dfc60..600105e7 100644 --- a/dxsdk/Include/strmif.h +++ b/dxsdk/Include/strmif.h @@ -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 */ diff --git a/src/Camera.cpp b/src/Camera.cpp index 368a77d1..999792dd 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -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; diff --git a/src/Camera.h b/src/Camera.h index 6669ff13..9154b614 100644 --- a/src/Camera.h +++ b/src/Camera.h @@ -1,5 +1,4 @@ #pragma once - #include "Placeable.h" class CEntity; diff --git a/src/CdStream.cpp b/src/CdStream.cpp index 506e14e9..255e46bb 100644 --- a/src/CdStream.cpp +++ b/src/CdStream.cpp @@ -1,4 +1,4 @@ -#include +#include #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; diff --git a/src/FileLoader.cpp b/src/FileLoader.cpp index 8213a5c7..8bc6ad11 100644 --- a/src/FileLoader.cpp +++ b/src/FileLoader.cpp @@ -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; } diff --git a/src/Pad.cpp b/src/Pad.cpp index e6f36efd..13b9b589 100644 --- a/src/Pad.cpp +++ b/src/Pad.cpp @@ -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; } diff --git a/src/Placeable.h b/src/Placeable.h index bca9462d..868ca9e7 100644 --- a/src/Placeable.h +++ b/src/Placeable.h @@ -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); diff --git a/src/Radar.cpp b/src/Radar.cpp index 839aa3af..ec02144e 100644 --- a/src/Radar.cpp +++ b/src/Radar.cpp @@ -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, diff --git a/src/RwHelper.cpp b/src/RwHelper.cpp index 3c198272..8dade266 100644 --- a/src/RwHelper.cpp +++ b/src/RwHelper.cpp @@ -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 diff --git a/src/RwMatFX.cpp b/src/RwMatFX.cpp index ca47e529..5fd00c54 100644 --- a/src/RwMatFX.cpp +++ b/src/RwMatFX.cpp @@ -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); diff --git a/src/Streaming.h b/src/Streaming.h index d0c6fc68..212a6d71 100644 --- a/src/Streaming.h +++ b/src/Streaming.h @@ -1,5 +1,7 @@ #pragma once +#include "Game.h" + enum { STREAM_OFFSET_MODEL = 0, STREAM_OFFSET_TXD = STREAM_OFFSET_MODEL+MODELINFOSIZE, diff --git a/src/Timer.cpp b/src/Timer.cpp index 2f7dc38d..543f582b 100644 --- a/src/Timer.cpp +++ b/src/Timer.cpp @@ -1,4 +1,4 @@ -#include +#include #include "common.h" #include "patcher.h" #include "DMAudio.h" diff --git a/src/TxdStore.cpp b/src/TxdStore.cpp index 6ff7e852..5085c7e4 100644 --- a/src/TxdStore.cpp +++ b/src/TxdStore.cpp @@ -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; } } diff --git a/src/animation/AnimBlendHierarchy.cpp b/src/animation/AnimBlendHierarchy.cpp index c7d7f198..e4bcdc69 100644 --- a/src/animation/AnimBlendHierarchy.cpp +++ b/src/animation/AnimBlendHierarchy.cpp @@ -9,7 +9,7 @@ CAnimBlendHierarchy::CAnimBlendHierarchy(void) numSequences = 0; compressed = 0; totalLength = 0.0f; - linkPtr = 0; + linkPtr = nil; } void diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index 3d1439c6..17394743 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -366,7 +366,7 @@ RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta) updateData.foobar = 1; } } - updateData.nodes[i] = 0; + updateData.nodes[i] = nil; clumpData->ForAllFrames(FrameUpdateCallBack, &updateData); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 6f2d3d86..7b7c1182 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -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: diff --git a/src/common.h b/src/common.h index 0345b65c..efbc1f8c 100644 --- a/src/common.h +++ b/src/common.h @@ -14,7 +14,7 @@ #include #ifdef WITHD3D -#include +#include #include #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)) diff --git a/src/control/PedPlacement.cpp b/src/control/PedPlacement.cpp index de4cdae1..e9a3f7d9 100644 --- a/src/control/PedPlacement.cpp +++ b/src/control/PedPlacement.cpp @@ -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); diff --git a/src/debugmenu_public.h b/src/debugmenu_public.h index 3671caca..778e7afe 100644 --- a/src/debugmenu_public.h +++ b/src/debugmenu_public.h @@ -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"); diff --git a/src/entities/CutsceneObject.cpp b/src/entities/CutsceneObject.cpp index a7bca122..9089f600 100644 --- a/src/entities/CutsceneObject.cpp +++ b/src/entities/CutsceneObject.cpp @@ -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) diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 7f83ea84..828e9c19 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -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" @@ -416,7 +416,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 +447,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 +456,7 @@ RwFrame* CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data) { RwFrameForAllObjects(frame, SetPedAtomicVisibilityCB, data); - RwFrameForAllChildren(frame, RecurseFrameChildrenVisibilityCB, 0); + RwFrameForAllChildren(frame, RecurseFrameChildrenVisibilityCB, nil); return frame; } @@ -824,7 +824,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 +873,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 +892,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; } diff --git a/src/main.cpp b/src/main.cpp index c8af9ae0..307d0b66 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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" diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp index f44c86b6..37f94c93 100644 --- a/src/modelinfo/BaseModelInfo.cpp +++ b/src/modelinfo/BaseModelInfo.cpp @@ -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; } diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index 4a19f1df..24deed38 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -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 diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index e095902e..775148c9 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -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* diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 2f1d2027..78eee96c 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -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 diff --git a/src/re3.cpp b/src/re3.cpp index 70601186..3df44620 100644 --- a/src/re3.cpp +++ b/src/re3.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #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) diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index f7a6f7d5..61fa1a5a 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -9,7 +9,7 @@ #include "World.h" #include "Weather.h" #include "Collision.h" -#include "TimeCycle.h" +#include "Timecycle.h" #include "Coronas.h" struct FlareDef diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 6ade9b60..83e62ba0 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -543,7 +543,7 @@ void CHud::Draw() } } else { - m_pLastZoneName = 0; + m_pLastZoneName = nil; m_ZoneState = 0; m_ZoneFadeTimer = 0; m_ZoneNameTimer = 0; @@ -639,7 +639,7 @@ void CHud::Draw() } } else { - m_pLastVehicleName = 0; + m_pLastVehicleName = nil; m_VehicleState = 0; m_VehicleFadeTimer = 0; m_VehicleNameTimer = 0; @@ -1234,9 +1234,9 @@ WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); } void CHud::GetRidOfAllHudMessages() { m_ZoneState = 0; - m_pLastZoneName = 0; + m_pLastZoneName = nil; m_ZoneNameTimer = 0; - m_pZoneName = 0; + m_pZoneName = nil; for (int i = 0; i < 256; i++) { m_HelpMessage[i] = 0; @@ -1249,9 +1249,9 @@ void CHud::GetRidOfAllHudMessages() m_HelpMessageState = 0; m_HelpMessageQuick = 0; m_HelpMessageDisplayTime = 1.0f; - m_VehicleName = 0; - m_pLastVehicleName = 0; - m_pVehicleNameToPrint = 0; + m_VehicleName = nil; + m_pLastVehicleName = nil; + m_pVehicleNameToPrint = nil; m_VehicleNameTimer = 0; m_VehicleFadeTimer = 0; m_VehicleState = 0; @@ -1284,8 +1284,8 @@ void CHud::Initialise() Sprites[i].SetTexture(WeaponFilenames[i * 2]); } - gpSniperSightTex = RwTextureRead("sitesniper", 0); - gpRocketSightTex = RwTextureRead("siterocket", 0); + gpSniperSightTex = RwTextureRead("sitesniper", nil); + gpRocketSightTex = RwTextureRead("siterocket", nil); CTxdStore::PopCurrentTxd(); } @@ -1427,10 +1427,10 @@ void CHud::Shutdown() } RwTextureDestroy(gpSniperSightTex); - gpSniperSightTex = 0; + gpSniperSightTex = nil; RwTextureDestroy(gpRocketSightTex); - gpRocketSightTex = 0; + gpRocketSightTex = nil; int HudTXD = CTxdStore::FindTxdSlot("hud"); CTxdStore::RemoveTxdSlot(HudTXD); diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index 1d344d35..1cf27ee0 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -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) diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 5b25cfa3..416e5af0 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -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); } } diff --git a/src/render/Particle.h b/src/render/Particle.h index 5db91727..92b6809e 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -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(); diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp index 440ea9cb..7a1804de 100644 --- a/src/render/ParticleMgr.cpp +++ b/src/render/ParticleMgr.cpp @@ -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++; diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index aa49d218..ecc0083d 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -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(); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 2943475b..9638e53a 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -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.)