From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: Modernize project codebase (#906) * Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR --- .../PS3/4JLibs/STO_TitleSmallStorage.cpp | 16 +- Minecraft.Client/PS3/4JLibs/inc/4J_Input.h | 4 +- Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/PS3/4JLibs/inc/4J_Render.h | 6 +- Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h | 10 +- Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp | 8 +- Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp | 84 +++--- Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h | 2 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl | 154 +++++------ Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl | 86 +++--- Minecraft.Client/PS3/Iggy/include/gdraw.h | 8 +- Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h | 4 +- .../PS3/Leaderboards/PS3LeaderboardManager.cpp | 52 ++-- .../PS3/Network/SQRNetworkManager_PS3.cpp | 128 ++++----- .../PS3/Network/SQRNetworkManager_PS3.h | 2 +- Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp | 52 ++-- Minecraft.Client/PS3/Network/SonyCommerce_PS3.h | 4 +- Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp | 54 ++-- .../PS3/Network/SonyRemoteStorage_PS3.cpp | 22 +- Minecraft.Client/PS3/Network/SonyVoiceChat.cpp | 14 +- Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp | 14 +- Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h | 4 +- Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp | 2 +- Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp | 8 +- Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp | 18 +- Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp | 4 +- Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/winerror.h | 2 +- Minecraft.Client/PS3/PS3_App.cpp | 60 ++-- Minecraft.Client/PS3/PS3_App.h | 2 +- Minecraft.Client/PS3/PS3_Minecraft.cpp | 34 +-- .../PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp | 130 ++++----- .../PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h | 20 +- .../PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h | 2 +- .../ChunkUpdate/PistonExtensionTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp | 44 +-- .../ChunkUpdate/TheEndPortalFrameTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp | 306 ++++++++++----------- .../PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp | 36 +-- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h | 6 +- .../CompressedTile/CompressedTileStorage_SPU.cpp | 8 +- 68 files changed, 750 insertions(+), 746 deletions(-) (limited to 'Minecraft.Client/PS3') diff --git a/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp b/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp index f3d2729f..bb7c88c7 100644 --- a/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp +++ b/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp @@ -58,7 +58,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) { int32_t ret = 0; int32_t transId = 0; - void *data=NULL; + void *data=nullptr; size_t dataSize=0; SceNpId npId; @@ -100,7 +100,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) //memset(&npclient_info, 0x00, sizeof(npclient_info)); data = malloc(SCE_NET_NP_TSS_MAX_SIZE); - if (data == NULL) + if (data == nullptr) { printf("out of memory: can't allocate memory for titleSmallStorage\n"); ret = -1; @@ -121,7 +121,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) // data, // SCE_NET_NP_TSS_MAX_SIZE, // &dataSize, -// NULL); +// nullptr); // if (ret < 0) // { // printf("sceNpLookupTitleSmallStorage() failed. ret = 0x%x\n", ret); @@ -150,7 +150,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) size_t dataSize; SceNpTssSlotId slotId=SLOTID; SceNpTssDataStatus dataStatus; - const char *ptr =NULL; + const char *ptr =nullptr; size_t recvdSize=0; size_t totalSize=0; size_t recvSize=0; @@ -163,7 +163,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) sizeof(SceNpTssDataStatus), ptr, recvSize, - NULL); + nullptr); if (ret < 0) { // Error handling @@ -174,10 +174,10 @@ int32_t CTSS::doLookupTitleSmallStorage(void) // Processing when there is no data goto finish; } - if (ptr == NULL) + if (ptr == nullptr) { ptr = malloc(dataStatus.contentLength); - if (ptr == NULL){ + if (ptr == nullptr){ // Error handling goto error; } @@ -197,7 +197,7 @@ error: ret = sceNpLookupDestroyTransactionCtx(transId); printf("sceNpLookupDestroyTransactionCtx() done. ret = 0x%x\n", ret); } - if (data != NULL) + if (data != nullptr) { free(data); } diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h index 6f51bba5..9d46e741 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h @@ -130,8 +130,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h index 888c38cc..4a65dcb9 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h @@ -109,7 +109,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h index d55f440b..1b68695f 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h @@ -17,8 +17,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { delete m_pBuffer; m_pBuffer = NULL; } - bool Allocated() { return m_pBuffer != NULL; } + void Release() { delete m_pBuffer; m_pBuffer = nullptr; } + bool Allocated() { return m_pBuffer != nullptr; } }; typedef struct @@ -60,7 +60,7 @@ public: void InitialiseContext(); void StartFrame(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = NULL); + void Clear(int flags, D3D11_RECT *pRect = nullptr); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h index 3950bbad..b95325b3 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h @@ -293,7 +293,7 @@ typedef struct // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=USER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, StringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, StringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0); C4JStorage::EMessageResult GetMessageBoxResult(); @@ -350,7 +350,7 @@ typedef struct void FreeSaveData(); void SetSaveDataSize(unsigned int uiBytes); // after a successful compression, update the size of the gamedata - //void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=NULL,DWORD cbThumbnail=0,PBYTE pbTextData=NULL, DWORD dwTextLen=0); + //void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=nullptr,DWORD cbThumbnail=0,PBYTE pbTextData=nullptr, DWORD dwTextLen=0); C4JStorage::ESaveGameState SaveSaveData(int( *Func)(LPVOID ,const bool),LPVOID lpParam, bool bDataFileOnly = false); void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam); void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected); @@ -383,8 +383,8 @@ typedef struct DWORD GetAvailableDLCCount( int iPad); CONTENT_DATA& GetDLC(DWORD dw); C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = NULL); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = nullptr); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int),LPVOID lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; } @@ -400,7 +400,7 @@ typedef struct bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)/*=NULL*/,LPVOID lpParam/*=NULL*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)/*=nullptr*/,LPVOID lpParam/*=nullptr*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} // PROFILE DATA int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam); diff --git a/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp b/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp index fcce5f05..1c7edba3 100644 --- a/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp +++ b/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp @@ -37,7 +37,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = ch_pcm; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; /* No downmixer is used */ - cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ); + cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ); ret = ch_pcm; } @@ -51,7 +51,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = 6; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_TYPE_B; - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) != CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) != CELL_OK ) { return 0; // error - the downmixer didn't init } @@ -83,7 +83,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) ret = 8; } - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) == CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) == CELL_OK ) { break; } @@ -94,7 +94,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = 2; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_TYPE_A; - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) != CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) != CELL_OK ) { return 0; // error - downmixer didn't work } diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp index 997e8d83..e8bd0367 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp @@ -751,7 +751,7 @@ static void api_free_resource(GDrawHandle *r) S32 i; for (i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; } static void RADLINK gdraw_UnlockHandles(GDrawStats *stats) @@ -772,7 +772,7 @@ extern GDrawTexture *gdraw_GCM_WrappedTextureCreate(CellGcmTexture *gcm_tex) memset(&stats, 0, sizeof(stats)); GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle p->handle.tex.gcm_ptr = 0; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); gdraw_GCM_WrappedTextureChange((GDrawTexture *) p, gcm_tex); return (GDrawTexture *) p; } @@ -816,11 +816,11 @@ static bool is_texture_swizzled(S32 w, S32 h) static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; bool swizzled = false; if (width > 4096 || height > 4096) { - IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension size limit 4096)", width, height); + IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension size limit 4096)", width, height); return false; } @@ -893,7 +893,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, if (swizzled || (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap)) { rrbool ok; - assert(p->temp_buffer != NULL); + assert(p->temp_buffer != nullptr); ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, mipmaps, bytes_pixel, p->temp_buffer, p->temp_buffer_bytes); assert(ok); // this should never hit unless the temp_buffer is way too small @@ -1023,8 +1023,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == nullptr) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -1121,7 +1121,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); // @GDRAW_ASSERT + assert(h != nullptr); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -1152,19 +1152,19 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); return t; } void *ptr = gdraw_arena_alloc(&gdraw->rt_arena, size, 1); if (!ptr) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); gdraw_HandleCacheAllocateFail(t); - return NULL; + return nullptr; } t->fence = get_next_fence(); // we're about to start using it immediately, so... - t->raw_ptr = NULL; + t->raw_ptr = nullptr; t->handle.tex.gcm_ptr = ptr; @@ -1329,14 +1329,14 @@ static void set_common_renderstate() // reset our state caching for (i=0; i < MAX_SAMPLERS; i++) { - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; cellGcmSetTextureControl(gcm, i, CELL_GCM_FALSE, 0, 0, 0); } assert(gdraw->aa_tex.offset != 0); // if you hit this, your initialization is screwed up. set_rsx_texture(gdraw->gcm, AATEX_SAMPLER, &gdraw->aa_tex, GDRAW_WRAP_clamp, 0); - gdraw->cur_fprog = NULL; + gdraw->cur_fprog = nullptr; gdraw->vert_format = -1; gdraw->scissor_state = ~0u; gdraw->blend_mode = -1; @@ -1363,7 +1363,7 @@ static void clear_renderstate(void) static void set_render_target() { - GcmTexture *tex = NULL; + GcmTexture *tex = nullptr; S32 i; CellGcmSurface surf = gdraw->main_surface; @@ -1384,7 +1384,7 @@ static void set_render_target() // invalidate current textures (need to reset them to force L1 texture cache flush) for (i=0; i < MAX_SAMPLERS; ++i) - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; } //////////////////////////////////////////////////////////////////////// @@ -1513,19 +1513,19 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawFramebufferState *n = gdraw->cur+1; GDrawHandle *t; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { // @TODO implement - t = NULL; + t = nullptr; assert(0); // nyi } else { t = get_color_rendertarget(stats); @@ -1534,9 +1534,9 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex } n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT - n->cached = owner != NULL; + n->cached = owner != nullptr; if (owner) { n->base_x = region->x0; n->base_y = region->y0; @@ -1617,9 +1617,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT + assert(m->color_buffer != nullptr); // @GDRAW_ASSERT } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT // wait for render to texture operation to finish // can't put down a backend fence directly, there might still be @@ -1694,7 +1694,7 @@ static void set_fragment_para(GDraw * RADRESTRICT gd, U32 ucode_offs, int para, if (para == -1) return; - gd->cur_fprog = NULL; // need to re-set shader after patching + gd->cur_fprog = nullptr; // need to re-set shader after patching const U64 *inv = (const U64 *) values; const int *patch_offs = (const int *) para; @@ -1728,7 +1728,7 @@ static void set_fragment_para(GDraw * RADRESTRICT gd, U32 ucode_offs, int para, static RADINLINE void set_texture(S32 texunit, GDrawTexture *tex) { assert(texunit < MAX_SAMPLERS); - assert(tex != NULL); + assert(tex != nullptr); if (gdraw->active_tex[texunit] != tex) { gdraw->active_tex[texunit] = tex; @@ -1983,7 +1983,7 @@ static RADINLINE void set_vertex_decl(GDraw * RADRESTRICT gd, CellGcmContextData // Draw triangles with a given renderstate // -static RADINLINE void fence_resources(GDraw * RADRESTRICT gd, void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) +static RADINLINE void fence_resources(GDraw * RADRESTRICT gd, void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) { GDrawFence fence; fence.value = gd->next_fence_index; @@ -2046,7 +2046,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti while (pos < p->num_indices) { S32 vert_count = RR_MIN(p->num_indices - pos, verts_per_chunk); void *ring = gdraw_bufring_alloc(&gd->dyn_vb, vert_count * vsize, CELL_GCM_VERTEX_TEXTURE_CACHE_LINE_SIZE); - assert(ring != NULL); // we specifically chunked so this alloc succeeds! + assert(ring != nullptr); // we specifically chunked so this alloc succeeds! // prepare for painting... cellGcmSetInvalidateVertexCache(gcm); @@ -2083,7 +2083,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti S32 vert_count = RR_MIN(p->num_vertices - pos, verts_per_chunk); U32 chunk_bytes = vert_count * vsize; void *ring = gdraw_bufring_alloc(&gd->dyn_vb, chunk_bytes, CELL_GCM_VERTEX_TEXTURE_CACHE_LINE_SIZE); - assert(ring != NULL); // we picked the chunk size so this alloc succeeds! + assert(ring != nullptr); // we picked the chunk size so this alloc succeeds! memcpy(ring, (U8 *)p->vertices + pos * vsize, chunk_bytes); cellGcmSetInvalidateVertexCache(gcm); @@ -2203,7 +2203,7 @@ static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbe { ProgramWithCachedVariableLocations *prg = &gdraw->filter_prog[isbevel][r->filter_mode]; U32 ucode_offs = prg->cfg.offset; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) return; set_texture(0, r->tex[0]); @@ -2287,14 +2287,14 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = NULL; + GDrawHandle *blend_tex = nullptr; GDraw *gd = gdraw; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. so we need to copy the // relevant pixels from our active render target into a texture. if (r->blend_mode == GDRAW_BLEND_special && - (blend_tex = get_color_rendertarget(stats)) != NULL) { + (blend_tex = get_color_rendertarget(stats)) != nullptr) { // slightly different logic depending on whether we were rendering // to the main color buffer or a render target, because the former // has tile origin-based coordinates while the latter don't. also, @@ -2344,7 +2344,7 @@ static void create_fragment_program(ProgramWithCachedVariableLocations *p, Progr cellGcmCgGetUCode(p->program, &ucode_main, &ucode_size); ucode_local = gdraw_arena_alloc(&gdraw->local_arena, ucode_size + 400, CELL_GCM_FRAGMENT_UCODE_LOCAL_ALIGN_OFFSET); // 400 for overfetch - assert(ucode_local != NULL); // if this triggers, it's a GDraw bug + assert(ucode_local != nullptr); // if this triggers, it's a GDraw bug memcpy(ucode_local, ucode_main, ucode_size); cellGcmCgGetCgbFragmentProgramConfiguration(p->program, &p->cfg, 0, 1, 0); @@ -2408,7 +2408,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_gcm_resourcetype type, U32 alig U32 header_size = is_vertex ? 0 : sizeof(GcmTexture) * num_handles; if (!num_handles) - return NULL; + return nullptr; GDrawHandleCache *cache = (GDrawHandleCache *) IggyGDrawMalloc(cache_size + header_size); if (cache) { @@ -2427,7 +2427,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_gcm_resourcetype type, U32 alig cache->alloc = gfxalloc_create(gdraw_mem[type].ptr, num_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - cache = NULL; + cache = nullptr; } } @@ -2496,14 +2496,14 @@ int gdraw_GCM_SetResourceMemory(gdraw_gcm_resourcetype type, S32 num_handles, vo free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_GCM_RESOURCE_texture, CELL_GCM_TEXTURE_SWIZZLE_ALIGN_OFFSET); gdraw->tex_loc = get_location(ptr); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_GCM_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_GCM_RESOURCE_vertexbuffer, CELL_GCM_SURFACE_LINEAR_ALIGN_OFFSET); gdraw->vbuf_base = ptr ? (U8 *) ptr - addr2offs(ptr) : 0; gdraw->vbuf_loc = get_location(ptr); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; case GDRAW_GCM_RESOURCE_dyn_vertexbuffer: gdraw_bufring_shutdown(&gdraw->dyn_vb); @@ -2549,10 +2549,10 @@ int gdraw_GCM_SetRendertargetMemory(void *ptr, S32 num_bytes, S32 width, S32 hei void gdraw_GCM_ResetAllResourceMemory() { - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_texture, 0, NULL, 0); - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_vertexbuffer, 0, NULL, 0); - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_dyn_vertexbuffer, 0, NULL, 0); - gdraw_GCM_SetRendertargetMemory(NULL, 0, 0, 0, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_texture, 0, nullptr, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_vertexbuffer, 0, nullptr, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_dyn_vertexbuffer, 0, nullptr, 0); + gdraw_GCM_SetRendertargetMemory(nullptr, 0, 0, 0, 0); } GDrawFunctions *gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_workmem, U8 rsx_label_index) @@ -2560,7 +2560,7 @@ GDrawFunctions *gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_wor S32 i; gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); // make sure gdraw struct is PPU cache line aligned - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -2648,7 +2648,7 @@ void gdraw_GCM_DestroyContext(void) free_handle_cache(gdraw->texturecache); free_handle_cache(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } } diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h index f8ec8705..cf691d06 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h @@ -108,7 +108,7 @@ IDOC extern GDrawFunctions * gdraw_GCM_CreateContext(CellGcmContextData *gcm, vo There can only be one GCM GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_GCM_DestroyContext(void); /* Destroys the current GDraw context, if any. */ diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl index 811f524a..4d3c91bb 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl @@ -273,24 +273,24 @@ static int pshader_basic_econst[28] = { }; static ProgramWithCachedVariableLocations pshader_basic_arr[18] = { - { { pshader_basic_0 }, { NULL }, { -1, 7, -1, -1, -1, } }, - { { pshader_basic_1 }, { NULL }, { -1, 7, -1, (int) (intptr_t) (pshader_basic_econst + 0), -1, } }, - { { pshader_basic_2 }, { NULL }, { -1, 7, -1, (int) (intptr_t) (pshader_basic_econst + 0), -1, } }, - { { pshader_basic_3 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_4 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 2), -1, } }, - { { pshader_basic_5 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 4), -1, } }, - { { pshader_basic_6 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_7 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 6), -1, } }, - { { pshader_basic_8 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 6), -1, } }, - { { pshader_basic_9 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_10 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 8), -1, } }, - { { pshader_basic_11 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 10), -1, } }, - { { pshader_basic_12 }, { NULL }, { 0, 7, -1, -1, (int) (intptr_t) (pshader_basic_econst + 12), } }, - { { pshader_basic_13 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 16), (int) (intptr_t) (pshader_basic_econst + 18), } }, - { { pshader_basic_14 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 22), (int) (intptr_t) (pshader_basic_econst + 24), } }, - { { pshader_basic_15 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_16 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 2), -1, } }, - { { pshader_basic_17 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 6), -1, } }, + { { pshader_basic_0 }, { nullptr }, { -1, 7, -1, -1, -1, } }, + { { pshader_basic_1 }, { nullptr }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, + { { pshader_basic_2 }, { nullptr }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, + { { pshader_basic_3 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_4 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, + { { pshader_basic_5 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 4)), -1, } }, + { { pshader_basic_6 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_7 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_8 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_9 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_10 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 8)), -1, } }, + { { pshader_basic_11 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 10)), -1, } }, + { { pshader_basic_12 }, { nullptr }, { 0, 7, -1, -1, static_cast((intptr_t)(pshader_basic_econst + 12)), } }, + { { pshader_basic_13 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 16)), static_cast((intptr_t)(pshader_basic_econst + 18)), } }, + { { pshader_basic_14 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 22)), static_cast((intptr_t)(pshader_basic_econst + 24)), } }, + { { pshader_basic_15 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_16 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, + { { pshader_basic_17 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, }; static unsigned char pshader_exceptional_blend_1[368] = { @@ -536,19 +536,19 @@ static int pshader_exceptional_blend_econst[4] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { { NULL }, { NULL }, { -1, -1, -1, -1, } }, - { { pshader_exceptional_blend_1 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_2 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_3 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_4 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_5 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_6 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_7 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_8 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_9 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_10 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, - { { pshader_exceptional_blend_11 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 2), } }, - { { pshader_exceptional_blend_12 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 2), } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, } }, + { { pshader_exceptional_blend_1 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_2 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_3 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_4 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_5 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_6 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_7 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_8 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_9 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_10 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_11 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, + { { pshader_exceptional_blend_12 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, }; static unsigned char pshader_filter_0[416] = { @@ -1121,38 +1121,38 @@ static int pshader_filter_econst[90] = { }; static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { - { { pshader_filter_0 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 0), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, - { { pshader_filter_1 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 11), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, - { { pshader_filter_2 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 13), 2, (int) (intptr_t) (pshader_filter_econst + 16), (int) (intptr_t) (pshader_filter_econst + 5), -1, } }, - { { pshader_filter_3 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 13), 2, (int) (intptr_t) (pshader_filter_econst + 16), (int) (intptr_t) (pshader_filter_econst + 5), -1, } }, - { { pshader_filter_4 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 19), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, - { { pshader_filter_5 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 11), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, - { { pshader_filter_6 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 2), 2, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, - { { pshader_filter_7 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 13), 2, (int) (intptr_t) (pshader_filter_econst + 16), (int) (intptr_t) (pshader_filter_econst + 5), -1, } }, - { { pshader_filter_8 }, { NULL }, { -1, 1, (int) (intptr_t) (pshader_filter_econst + 21), -1, -1, -1, (int) (intptr_t) (pshader_filter_econst + 24), -1, } }, - { { pshader_filter_9 }, { NULL }, { -1, -1, (int) (intptr_t) (pshader_filter_econst + 27), -1, -1, -1, -1, -1, } }, - { { pshader_filter_10 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 2), 2, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, - { { pshader_filter_11 }, { NULL }, { 0, -1, -1, (int) (intptr_t) (pshader_filter_econst + 29), 2, (int) (intptr_t) (pshader_filter_econst + 32), -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { pshader_filter_16 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 35), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 46), (int) (intptr_t) (pshader_filter_econst + 49), } }, - { { pshader_filter_17 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 47), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 51), (int) (intptr_t) (pshader_filter_econst + 35), } }, - { { pshader_filter_18 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 37), 2, (int) (intptr_t) (pshader_filter_econst + 54), (int) (intptr_t) (pshader_filter_econst + 59), -1, } }, - { { pshader_filter_19 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 62), 2, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 66), -1, } }, - { { pshader_filter_20 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 35), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 46), (int) (intptr_t) (pshader_filter_econst + 49), } }, - { { pshader_filter_21 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 47), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 51), (int) (intptr_t) (pshader_filter_econst + 35), } }, - { { pshader_filter_22 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 69), 2, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 73), -1, } }, - { { pshader_filter_23 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 62), 2, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 66), -1, } }, - { { pshader_filter_24 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 35), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 46), (int) (intptr_t) (pshader_filter_econst + 49), } }, - { { pshader_filter_25 }, { NULL }, { 0, -1, (int) (intptr_t) (pshader_filter_econst + 76), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), -1, (int) (intptr_t) (pshader_filter_econst + 67), } }, - { { pshader_filter_26 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 78), 2, (int) (intptr_t) (pshader_filter_econst + 82), (int) (intptr_t) (pshader_filter_econst + 87), -1, } }, - { { pshader_filter_27 }, { NULL }, { 0, -1, -1, (int) (intptr_t) (pshader_filter_econst + 37), 2, (int) (intptr_t) (pshader_filter_econst + 41), -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { pshader_filter_0 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 0)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_1 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_2 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, + { { pshader_filter_3 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, + { { pshader_filter_4 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 19)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_5 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_6 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_7 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, + { { pshader_filter_8 }, { nullptr }, { -1, 1, static_cast((intptr_t)(pshader_filter_econst + 21)), -1, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 24)), -1, } }, + { { pshader_filter_9 }, { nullptr }, { -1, -1, static_cast((intptr_t)(pshader_filter_econst + 27)), -1, -1, -1, -1, -1, } }, + { { pshader_filter_10 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_11 }, { nullptr }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 29)), 2, static_cast((intptr_t)(pshader_filter_econst + 32)), -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { pshader_filter_16 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, + { { pshader_filter_17 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, + { { pshader_filter_18 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 54)), static_cast((intptr_t)(pshader_filter_econst + 59)), -1, } }, + { { pshader_filter_19 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, + { { pshader_filter_20 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, + { { pshader_filter_21 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, + { { pshader_filter_22 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 69)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 73)), -1, } }, + { { pshader_filter_23 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, + { { pshader_filter_24 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, + { { pshader_filter_25 }, { nullptr }, { 0, -1, static_cast((intptr_t)(pshader_filter_econst + 76)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, static_cast((intptr_t)(pshader_filter_econst + 67)), } }, + { { pshader_filter_26 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 78)), 2, static_cast((intptr_t)(pshader_filter_econst + 82)), static_cast((intptr_t)(pshader_filter_econst + 87)), -1, } }, + { { pshader_filter_27 }, { nullptr }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, }; static unsigned char pshader_blur_2[368] = { @@ -1560,16 +1560,16 @@ static int pshader_blur_econst[256] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { { NULL }, { NULL }, { -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, } }, - { { pshader_blur_2 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 0), (int) (intptr_t) (pshader_blur_econst + 13), } }, - { { pshader_blur_3 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 18), (int) (intptr_t) (pshader_blur_econst + 33), } }, - { { pshader_blur_4 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 40), (int) (intptr_t) (pshader_blur_econst + 57), } }, - { { pshader_blur_5 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 66), (int) (intptr_t) (pshader_blur_econst + 85), } }, - { { pshader_blur_6 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 96), (int) (intptr_t) (pshader_blur_econst + 117), } }, - { { pshader_blur_7 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 130), (int) (intptr_t) (pshader_blur_econst + 153), } }, - { { pshader_blur_8 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 168), (int) (intptr_t) (pshader_blur_econst + 193), } }, - { { pshader_blur_9 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 210), (int) (intptr_t) (pshader_blur_econst + 237), } }, + { { nullptr }, { nullptr }, { -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, } }, + { { pshader_blur_2 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 0)), static_cast((intptr_t)(pshader_blur_econst + 13)), } }, + { { pshader_blur_3 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 18)), static_cast((intptr_t)(pshader_blur_econst + 33)), } }, + { { pshader_blur_4 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 40)), static_cast((intptr_t)(pshader_blur_econst + 57)), } }, + { { pshader_blur_5 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 66)), static_cast((intptr_t)(pshader_blur_econst + 85)), } }, + { { pshader_blur_6 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 96)), static_cast((intptr_t)(pshader_blur_econst + 117)), } }, + { { pshader_blur_7 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 130)), static_cast((intptr_t)(pshader_blur_econst + 153)), } }, + { { pshader_blur_8 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 168)), static_cast((intptr_t)(pshader_blur_econst + 193)), } }, + { { pshader_blur_9 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 210)), static_cast((intptr_t)(pshader_blur_econst + 237)), } }, }; static unsigned char pshader_color_matrix_0[336] = { @@ -1598,7 +1598,7 @@ static int pshader_color_matrix_econst[12] = { }; static ProgramWithCachedVariableLocations pshader_color_matrix_arr[1] = { - { { pshader_color_matrix_0 }, { NULL }, { 0, (int) (intptr_t) (pshader_color_matrix_econst + 0), } }, + { { pshader_color_matrix_0 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_color_matrix_econst + 0)), } }, }; static unsigned char vshader_vsps3_0[272] = { @@ -1655,8 +1655,8 @@ static unsigned char vshader_vsps3_2[240] = { }; static ProgramWithCachedVariableLocations vshader_vsps3_arr[3] = { - { { vshader_vsps3_0 }, { NULL }, { } }, - { { vshader_vsps3_1 }, { NULL }, { } }, - { { vshader_vsps3_2 }, { NULL }, { } }, + { { vshader_vsps3_0 }, { nullptr }, { } }, + { { vshader_vsps3_1 }, { nullptr }, { } }, + { { vshader_vsps3_2 }, { nullptr }, { } }, }; diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl index 86293ab6..6f8dd9c0 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != NULL) { + while (s != nullptr) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState { check_lists(t->cache); assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning! + assert(t->state != static_cast(new_state)); // code should never call "transition" if it's not transitioning! // unlink from prev state t->prev->next = t->next; t->next->prev = t->prev; @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); + return gdraw_HandleCacheLockStats(t, owner, nullptr); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = NULL; // should never follow cache link from sentinels! + c->state[i].owner = nullptr; + c->state[i].cache = nullptr; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = NULL; + c->state[i].raw_ptr = nullptr; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = NULL; + c->handle[i].raw_ptr = nullptr; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = NULL; + c->alloc = nullptr; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = NULL; + c->alloc_other = nullptr; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = NULL; + t->raw_ptr = nullptr; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -563,7 +563,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; + return (sentinel->next != sentinel) ? sentinel->next : nullptr; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -778,7 +778,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats)) return r->tex[0]; - c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -830,7 +830,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo * assert(clamp[0] <= clamp[2]); assert(clamp[1] <= clamp[3]); - c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -842,7 +842,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR GDrawTexture *t; F32 data[MAX_TAPS][4]; S32 off_axis = 1-axis; - S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = static_cast(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 F32 inverse_weight = 1.0f / blur_width; @@ -949,7 +949,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR // max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample // 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width, // which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); + S32 w_mip = static_cast(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS))); S32 downsample = w_mip; F32 sample_spacing = texel; if (downsample < 2) downsample = 2; @@ -1095,7 +1095,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = NULL; + *start = nullptr; *num_bytes = 0; return; } else { @@ -1132,7 +1132,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return NULL; + return nullptr; arena->current = ptr + size; return ptr; @@ -1157,7 +1157,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash +// There's a single-linked, nullptr-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1166,7 +1166,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either +// single-linked, nullptr-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1384,7 +1384,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list != nullptr); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1457,7 +1457,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; + return nullptr; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1465,7 +1465,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return NULL; + return nullptr; memset(a, 0, size); @@ -1506,16 +1506,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, NULL, 0,0); + debug_complete_check(a, nullptr, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; + gfx_block_info *cur, *best = nullptr; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, NULL, 0,0); +debug_complete_check(alloc, nullptr, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1565,7 +1565,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return NULL; // not enough space! + return nullptr; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1735,7 +1735,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = NULL; + b->prev = nullptr; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1748,7 +1748,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1910,7 +1910,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = NULL; + void *ptr = nullptr; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2300,7 +2300,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = NULL; + ring->cur = nullptr; ring->seg_size = 0; } @@ -2310,7 +2310,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return NULL; // nope, won't fit + return nullptr; // nope, won't fit assert(align <= ring->align); @@ -2415,7 +2415,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2435,8 +2435,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return NULL; + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return nullptr; } #ifndef GDRAW_MANAGE_MEM @@ -2445,7 +2445,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2453,7 +2453,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); + gdraw_res_alloc_outofmem(c, nullptr, "memory"); break; } } @@ -2468,8 +2468,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); + if (t == nullptr) { + gdraw_res_alloc_outofmem(c, nullptr, "handles"); } } } @@ -2513,7 +2513,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = NULL; + r->owner = nullptr; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2521,11 +2521,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = NULL; + void *ptr = nullptr; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2537,7 +2537,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, NULL, "handles"); + return gdraw_res_alloc_outofmem(c, nullptr, "handles"); } // try to allocate first diff --git a/Minecraft.Client/PS3/Iggy/include/gdraw.h b/Minecraft.Client/PS3/Iggy/include/gdraw.h index 404a2642..7cc4ddd0 100644 --- a/Minecraft.Client/PS3/Iggy/include/gdraw.h +++ b/Minecraft.Client/PS3/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is NULL, then the pointers in 'prim' are machine pointers, and + If buf is nullptr, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-NULL, then use the appropriate vertex buffer, and the + If buf is non-nullptr, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured + $:return Handle for the newly created texture, or nullptr if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h b/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h index 1f1a90a1..a42ccbff 100644 --- a/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP +Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp index 38380bfb..27406186 100644 --- a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp +++ b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp @@ -30,7 +30,7 @@ PS3LeaderboardManager::PS3LeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = NULL; //m_stats = NULL; + m_scores = nullptr; //m_stats = nullptr; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -42,7 +42,7 @@ PS3LeaderboardManager::PS3LeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = NULL; + m_threadScoreboard = nullptr; } PS3LeaderboardManager::~PS3LeaderboardManager() @@ -196,7 +196,7 @@ bool PS3LeaderboardManager::getScoreByIds() CellRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = NULL; + SceNpId *npIds = nullptr; int ret; @@ -246,7 +246,7 @@ bool PS3LeaderboardManager::getScoreByIds() sceNpScoreDestroyTransactionCtx(ret); - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; return false; } else if (ret < 0) @@ -256,7 +256,7 @@ bool PS3LeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; return false; } else @@ -270,7 +270,7 @@ bool PS3LeaderboardManager::getScoreByIds() comments = new SceNpScoreComment[num]; /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -285,14 +285,14 @@ bool PS3LeaderboardManager::getScoreByIds() comments, sizeof(SceNpScoreComment) * num, //OUT: Comments - NULL, 0, // GameData. (unused) + nullptr, 0, // GameData. (unused) num, &last_sort_date, &mTotalRecord, - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -319,7 +319,7 @@ bool PS3LeaderboardManager::getScoreByIds() delete [] comments; delete [] npIds; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_maxRank = num; @@ -335,7 +335,7 @@ bool PS3LeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -368,7 +368,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[LeaderboardManger] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -422,14 +422,14 @@ bool PS3LeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - NULL, 0, // GameData. + nullptr, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -454,7 +454,7 @@ bool PS3LeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -472,7 +472,7 @@ bool PS3LeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != NULL) + if (m_readListener != nullptr) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -621,16 +621,16 @@ void PS3LeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = NULL; + m_scores = nullptr; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = NULL; + view.m_queries = nullptr; - if ( m_readListener != NULL ) + if ( m_readListener != nullptr ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -652,7 +652,7 @@ bool PS3LeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == NULL) + if (m_threadScoreboard == nullptr) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -747,7 +747,7 @@ void PS3LeaderboardManager::FlushStats() {} void PS3LeaderboardManager::CancelOperation() { - m_readListener = NULL; + m_readListener = nullptr; m_eStatsState = eStatsState_Canceled; if (m_transactionCtx != 0) @@ -897,7 +897,7 @@ void PS3LeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = in->data[i]; - unsigned char fivebits = strtol(ch, NULL, 32) << 3; + unsigned char fivebits = strtol(ch, nullptr, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -958,7 +958,7 @@ bool PS3LeaderboardManager::test_string(string testing) int ctx = sceNpScoreCreateTransactionCtx(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const void *) &comment, NULL); + int ret = sceNpScoreCensorComment(ctx, (const void *) &comment, nullptr); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp index 8ab30beb..a1a57443 100644 --- a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp @@ -19,8 +19,8 @@ #include "..\PS3Extras\PS3Strings.h" #include "PS3\Network\SonyRemoteStorage_PS3.h" -int (* SQRNetworkManager_PS3::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; -void * SQRNetworkManager_PS3::s_SignInCompleteParam = NULL; +int (* SQRNetworkManager_PS3::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; +void * SQRNetworkManager_PS3::s_SignInCompleteParam = nullptr; SceNpBasicPresenceDetails2 SQRNetworkManager_PS3::s_lastPresenceInfo = { 0 }; int SQRNetworkManager_PS3::s_resendPresenceCountdown = 0; bool SQRNetworkManager_PS3::s_presenceStatusDirty = false; @@ -96,8 +96,8 @@ SQRNetworkManager_PS3::SQRNetworkManager_PS3(ISQRNetworkManagerListener *listene m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = NULL; - m_gameBootInvite = NULL; + m_aServerId = nullptr; + m_gameBootInvite = nullptr; m_onlineStatus = false; m_bLinkDisconnected = false; @@ -151,7 +151,7 @@ void SQRNetworkManager_PS3::Initialise() // Initialise RUDP #ifdef __PS3__ - ret = cellRudpInit(NULL); + ret = cellRudpInit(nullptr); #else const int RUDP_POOL_SIZE = (500 * 1024); // TODO - find out what we need, this size is copied from library reference uint8_t *rudp_pool = (uint8_t *)malloc(RUDP_POOL_SIZE); @@ -258,7 +258,7 @@ void SQRNetworkManager_PS3::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } return; } @@ -268,7 +268,7 @@ void SQRNetworkManager_PS3::InitialiseAfterOnline() int ret = 0; if( !m_matching2initialised) { - ret = sceNpMatching2Init2(0, 0, NULL); + ret = sceNpMatching2Init2(0, 0, nullptr); } #else SceNpMatching2InitializeParameter initParam; @@ -339,7 +339,7 @@ void SQRNetworkManager_PS3::Tick() if( ( m_gameBootInvite ) && ( s_safeToRespondToGameBootInvite ) ) { m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - m_gameBootInvite = NULL; + m_gameBootInvite = nullptr; } ErrorHandlingTick(); @@ -399,12 +399,12 @@ void SQRNetworkManager_PS3::Tick() if( s_signInCompleteCallbackIfFailed ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -421,7 +421,7 @@ void SQRNetworkManager_PS3::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineGame) // m_offlineSQR ) // MGH - changed this to m_offlineGame, as m_offlineSQR can be true when running an online game but the init has failed because the servers are down @@ -531,7 +531,7 @@ void SQRNetworkManager_PS3::UpdateExternalRoomData() reqParam.roomBinAttrExternalNum = 1; reqParam.roomBinAttrExternal = &roomBinAttr; - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -564,7 +564,7 @@ bool SQRNetworkManager_PS3::FriendRoomManagerSearch() for( int i = 0; i < m_searchResultCount; i++ ) { free(m_aSearchResultRoomExtDataReceived[i]); - m_aSearchResultRoomExtDataReceived[i] = NULL; + m_aSearchResultRoomExtDataReceived[i] = nullptr; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -639,7 +639,7 @@ void SQRNetworkManager_PS3::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = NULL; + m_getFriendCountThread = nullptr; FriendRoomManagerSearch2(); } } @@ -813,7 +813,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByIndex(int idx) } else { - return NULL; + return nullptr; } } @@ -830,7 +830,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByXuid(PlayerUID xuid) @@ -846,7 +846,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetLocalPlayerByUserIndex(int idx) @@ -862,7 +862,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetHostPlayer() @@ -875,11 +875,11 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == NULL ) return NULL; + if( player == nullptr ) return nullptr; if( player->IsReady() ) return player; - return NULL; + return nullptr; } // Update state internally @@ -930,7 +930,7 @@ bool SQRNetworkManager_PS3::JoinRoom(SQRNetworkManager_PS3::SessionSearchResult { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -996,7 +996,7 @@ void SQRNetworkManager_PS3::LeaveRoom(bool bActuallyLeaveRoom) reqParam.roomId = m_room; SetState(SNM_INT_STATE_LEAVING); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1100,7 +1100,7 @@ bool SQRNetworkManager_PS3::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1148,7 +1148,7 @@ bool SQRNetworkManager_PS3::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; // Sync this back out to our networked clients... SyncRoomData(); @@ -1184,7 +1184,7 @@ bool SQRNetworkManager_PS3::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1216,7 +1216,7 @@ void SQRNetworkManager_PS3::SendInviteGUI() msg.mainType = SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE; msg.subType = SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT; msg.msgFeatures = SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE; - msg.npids = NULL; + msg.npids = nullptr; msg.count = 0; uint8_t *subject = mallocAndCreateUTF8ArrayFromString(IDS_INVITATION_SUBJECT_MAX_18_CHARS); @@ -1284,7 +1284,7 @@ void SQRNetworkManager_PS3::FindOrCreateNonNetworkPlayer(int slot, int playerTyp } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = NULL; + PlayerUID *pUID = nullptr; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST ) ) @@ -1351,7 +1351,7 @@ void SQRNetworkManager_PS3::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1407,7 +1407,7 @@ void SQRNetworkManager_PS3::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1499,7 +1499,7 @@ void SQRNetworkManager_PS3::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_PS3::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) +bool SQRNetworkManager_PS3::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) { assert( m_isHosting ); @@ -1618,7 +1618,7 @@ void SQRNetworkManager_PS3::RemoveRemotePlayersAndSync( SceNpMatching2RoomMember } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; } else { @@ -1660,7 +1660,7 @@ void SQRNetworkManager_PS3::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } // And delete the reference from the ctx->player map @@ -1711,7 +1711,7 @@ void SQRNetworkManager_PS3::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -1724,7 +1724,7 @@ bool SQRNetworkManager_PS3::GetMatchingContext(eSQRNetworkManagerInternalState a int ret = 0; if( !m_matching2initialised) { - ret = sceNpMatching2Init2(0, 0, NULL); + ret = sceNpMatching2Init2(0, 0, nullptr); } if( ret < 0 ) { @@ -1797,7 +1797,7 @@ bool SQRNetworkManager_PS3::GetServerContext() bool SQRNetworkManager_PS3::GetServerContext2() { // Get list of server IDs of servers allocated to the application - int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); + int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -1852,7 +1852,7 @@ bool SQRNetworkManager_PS3::GetServerContext(SceNpMatching2ServerId serverId) { // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // the context *really* is valid. - int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); + int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -1906,7 +1906,7 @@ void SQRNetworkManager_PS3::ServerContextTick() reqParam.serverId = m_serverId; SetState((m_state==SNM_INT_STATE_HOSTING_SERVER_FOUND)?SNM_INT_STATE_HOSTING_SERVER_SEARCH_CREATING_CONTEXT:SNM_INT_STATE_JOINING_SERVER_SEARCH_CREATING_CONTEXT); // Found a server - now try and create a context for it - int ret = sceNpMatching2CreateServerContext( m_matchingContext, &reqParam, NULL, &m_serverContextRequestId ); + int ret = sceNpMatching2CreateServerContext( m_matchingContext, &reqParam, nullptr, &m_serverContextRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT) ) { SetState((m_state==SNM_INT_STATE_HOSTING_SERVER_FOUND)?SNM_INT_STATE_HOSTING_SERVER_SEARCH_FAILED:SNM_INT_STATE_JOINING_SERVER_SEARCH_FAILED); @@ -1958,7 +1958,7 @@ void SQRNetworkManager_PS3::RoomCreateTick() SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM); app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2105,7 +2105,7 @@ bool SQRNetworkManager_PS3::SelectRandomServer() // Kick off the search - we'll get a callback to DefaultRequestCallback with the result from this app.DebugPrintf(CMinecraftApp::USER_RR,"Kicking off sceNpMatching2GetServerInfo for server id %d\n",reqParam.serverId); - int ret = sceNpMatching2GetServerInfo( m_matchingContext, &reqParam, NULL, &m_serverSearchRequestId); + int ret = sceNpMatching2GetServerInfo( m_matchingContext, &reqParam, nullptr, &m_serverSearchRequestId); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_GET_SERVER_INFO) ) { // Jump straight to an error state for this server @@ -2125,7 +2125,7 @@ void SQRNetworkManager_PS3::DeleteServerContext() reqParam.serverId = m_serverId; m_serverContextValid = false; SetState(SNM_INT_STATE_SERVER_DELETING_CONTEXT); - int ret = sceNpMatching2DeleteServerContext( m_matchingContext, &reqParam, NULL, &m_serverContextRequestId ); + int ret = sceNpMatching2DeleteServerContext( m_matchingContext, &reqParam, nullptr, &m_serverContextRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_DELETE_SERVER_CONTEXT) ) { ResetToIdle(); @@ -2203,7 +2203,7 @@ bool SQRNetworkManager_PS3::CreateRudpConnections(SceNpMatching2RoomId roomId, S if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); } else { @@ -2237,7 +2237,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx) @@ -2249,7 +2249,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRoomMemberAndLocalIdx(int return it->second; } } - return NULL; + return nullptr; } @@ -2342,7 +2342,7 @@ void SQRNetworkManager_PS3::ContextCallback(SceNpMatching2ContextId id, SceNpMa { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, NULL, NULL, NULL); + manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); break; } @@ -2373,7 +2373,7 @@ void SQRNetworkManager_PS3::ContextCallback(SceNpMatching2ContextId id, SceNpMa // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); -// s_SignInCompleteCallbackFn = NULL; +// s_SignInCompleteCallbackFn = nullptr; // } @@ -2510,7 +2510,7 @@ void SQRNetworkManager_PS3::DefaultRequestCallback(SceNpMatching2ContextId id, S } } - // If there was some problem getting data, then silently ignore as we don't want to go any further with a NULL data pointer, and this will just be indicating that the networking context + // If there was some problem getting data, then silently ignore as we don't want to go any further with a nullptr data pointer, and this will just be indicating that the networking context // is invalid which will be picked up elsewhere to shut everything down properly if( dataError ) { @@ -2706,7 +2706,7 @@ void SQRNetworkManager_PS3::DefaultRequestCallback(SceNpMatching2ContextId id, S // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); break; } @@ -2814,7 +2814,7 @@ void SQRNetworkManager_PS3::RoomEventCallback(SceNpMatching2ContextId id, SceNpM case SCE_NP_MATCHING2_ROOM_EVENT_RoomDestroyed: { SonyVoiceChat::signalRoomDestroyed(); - SceNpMatching2RoomUpdateInfo *pUpdateInfo=NULL; + SceNpMatching2RoomUpdateInfo *pUpdateInfo=nullptr; if( dataSize <= SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo ) { @@ -2937,7 +2937,7 @@ void SQRNetworkManager_PS3::RoomEventCallback(SceNpMatching2ContextId id, SceNpM reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); } } @@ -3037,7 +3037,7 @@ void SQRNetworkManager_PS3::SignallingCallback(SceNpMatching2ContextId ctxId, Sc reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_roomMemberDataRequestId); } else { @@ -3118,7 +3118,7 @@ void SQRNetworkManager_PS3::SysUtilCallback(uint64_t status, uint64_t param, voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } return; } @@ -3133,7 +3133,7 @@ void SQRNetworkManager_PS3::SysUtilCallback(uint64_t status, uint64_t param, voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } @@ -3204,7 +3204,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er if( dataSize >= sizeof(SQRNetworkPlayer::InitSendData) ) { SQRNetworkPlayer::InitSendData ISD; - unsigned int bytesRead = cellRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, NULL ); + unsigned int bytesRead = cellRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, nullptr ); if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) ) { manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD); @@ -3225,7 +3225,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er if( dataSize > 0 ) { unsigned char *data = new unsigned char [ dataSize ]; - unsigned int bytesRead = cellRudpRead( ctx_id, data, dataSize, 0, NULL ); + unsigned int bytesRead = cellRudpRead( ctx_id, data, dataSize, 0, nullptr ); if( bytesRead > 0 ) { SQRNetworkPlayer *playerFrom, *playerTo; @@ -3241,7 +3241,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) + if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3306,7 +3306,7 @@ void SQRNetworkManager_PS3::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); } if (ret < 0) { @@ -3335,7 +3335,7 @@ void SQRNetworkManager_PS3::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3386,9 +3386,9 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != NULL ) + // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != nullptr ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3412,14 +3412,14 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3434,7 +3434,7 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3530,7 +3530,7 @@ void SQRNetworkManager_PS3::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } diff --git a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h index 6143bbb5..4953b08f 100644 --- a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h +++ b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h @@ -125,7 +125,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp index 230e0309..7bd10110 100644 --- a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp @@ -9,22 +9,22 @@ bool SonyCommerce_PS3::m_bCommerceInitialised = false; SceNpCommerce2SessionInfo SonyCommerce_PS3::m_sessionInfo; SonyCommerce_PS3::State SonyCommerce_PS3::m_state = e_state_noSession; int SonyCommerce_PS3::m_errorCode = 0; -LPVOID SonyCommerce_PS3::m_callbackParam = NULL; +LPVOID SonyCommerce_PS3::m_callbackParam = nullptr; -void* SonyCommerce_PS3::m_receiveBuffer = NULL; +void* SonyCommerce_PS3::m_receiveBuffer = nullptr; SonyCommerce_PS3::Event SonyCommerce_PS3::m_event; std::queue SonyCommerce_PS3::m_messageQueue; -std::vector* SonyCommerce_PS3::m_pProductInfoList = NULL; -SonyCommerce_PS3::ProductInfoDetailed* SonyCommerce_PS3::m_pProductInfoDetailed = NULL; -SonyCommerce_PS3::ProductInfo* SonyCommerce_PS3::m_pProductInfo = NULL; +std::vector* SonyCommerce_PS3::m_pProductInfoList = nullptr; +SonyCommerce_PS3::ProductInfoDetailed* SonyCommerce_PS3::m_pProductInfoDetailed = nullptr; +SonyCommerce_PS3::ProductInfo* SonyCommerce_PS3::m_pProductInfo = nullptr; -SonyCommerce_PS3::CategoryInfo* SonyCommerce_PS3::m_pCategoryInfo = NULL; -const char* SonyCommerce_PS3::m_pProductID = NULL; -char* SonyCommerce_PS3::m_pCategoryID = NULL; +SonyCommerce_PS3::CategoryInfo* SonyCommerce_PS3::m_pCategoryInfo = nullptr; +const char* SonyCommerce_PS3::m_pProductID = nullptr; +char* SonyCommerce_PS3::m_pCategoryID = nullptr; SonyCommerce_PS3::CheckoutInputParams SonyCommerce_PS3::m_checkoutInputParams; SonyCommerce_PS3::DownloadListInputParams SonyCommerce_PS3::m_downloadInputParams; -SonyCommerce_PS3::CallbackFunc SonyCommerce_PS3::m_callbackFunc = NULL; +SonyCommerce_PS3::CallbackFunc SonyCommerce_PS3::m_callbackFunc = nullptr; sys_memory_container_t SonyCommerce_PS3::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_PS3::m_bUpgradingTrial = false; @@ -40,19 +40,19 @@ bool SonyCommerce_PS3::m_contextCreated=false; ///< npcommerce2 context ID c SonyCommerce_PS3::Phase SonyCommerce_PS3::m_currentPhase = e_phase_stopped; ///< Current commerce2 util char SonyCommerce_PS3::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_PS3::m_tickThread = NULL; +C4JThread* SonyCommerce_PS3::m_tickThread = nullptr; bool SonyCommerce_PS3::m_bLicenseChecked=false; // Check the trial/full license for the game SonyCommerce_PS3::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_PS3::Delete() { - m_pProductInfoList=NULL; - m_pProductInfoDetailed=NULL; - m_pProductInfo=NULL; - m_pCategoryInfo = NULL; - m_pProductID = NULL; - m_pCategoryID = NULL; + m_pProductInfoList=nullptr; + m_pProductInfoDetailed=nullptr; + m_pProductInfo=nullptr; + m_pCategoryInfo = nullptr; + m_pProductID = nullptr; + m_pCategoryID = nullptr; } void SonyCommerce_PS3::Init() { @@ -106,11 +106,11 @@ void SonyCommerce_PS3::CheckForTrialUpgradeKey() // 4J-PB - If we are the blu ray disc then we are the full version if(StorageManager.GetBootTypeDisc()) { - CheckForTrialUpgradeKey_Callback(NULL,true); + CheckForTrialUpgradeKey_Callback(nullptr,true); } else { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); } } @@ -498,7 +498,7 @@ int SonyCommerce_PS3::getDetailedProductInfo(ProductInfoDetailed *pInfo, const c if (categoryId && categoryId[0] != 0) { ret = sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); } else { - ret = sceNpCommerce2GetProductInfoStart(requestId, NULL, productId); + ret = sceNpCommerce2GetProductInfoStart(requestId, nullptr, productId); } if (ret < 0) { sceNpCommerce2DestroyReq(requestId); @@ -766,7 +766,7 @@ int SonyCommerce_PS3::checkout(CheckoutInputParams ¶ms) } } - for (int i = 0; i < params.skuIds.size(); i++) { + for (size_t i = 0; i < params.skuIds.size(); i++) { skuIdsTemp[i] = (const char *)(*iter); iter++; } @@ -794,7 +794,7 @@ int SonyCommerce_PS3::downloadList(DownloadListInputParams ¶ms) } } - for (int i = 0; i < params.skuIds.size(); i++) { + for (size_t i = 0; i < params.skuIds.size(); i++) { skuIdsTemp[i] = (const char *)(*iter); iter++; } @@ -887,7 +887,7 @@ int SonyCommerce_PS3::createContext() } // Create commerce2 context - ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); + ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); if (ret < 0) { app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -1325,7 +1325,7 @@ void SonyCommerce_PS3::processEvent() m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1349,7 +1349,7 @@ void SonyCommerce_PS3::processEvent() m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1410,8 +1410,8 @@ void SonyCommerce_PS3::CreateSession( CallbackFunc cb, LPVOID lpParam ) EnterCriticalSection(&m_queueLock); setCallback(cb,lpParam); m_messageQueue.push(e_message_commerceCreateSession); - if(m_tickThread == NULL) - m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_PS3 tick"); + if(m_tickThread == nullptr) + m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_PS3 tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; diff --git a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h index 1f43341a..05b48cf8 100644 --- a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h +++ b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h @@ -114,14 +114,14 @@ class SonyCommerce_PS3 : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = NULL; + m_callbackFunc = nullptr; if(func) func(m_callbackParam, m_errorCode); m_errorCode = CELL_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == NULL); + assert(m_callbackFunc == nullptr); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp index d38a1bc9..4e681354 100644 --- a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp @@ -10,10 +10,10 @@ static const int sc_SSLPoolSize = (512 * 1024U); static const int sc_CookiePoolSize = (256 * 1024U); -void* SonyHttp_PS3::uriPool = NULL; -void* SonyHttp_PS3::httpPool = NULL; -void* SonyHttp_PS3::sslPool = NULL; -void* SonyHttp_PS3::cookiePool = NULL; +void* SonyHttp_PS3::uriPool = nullptr; +void* SonyHttp_PS3::httpPool = nullptr; +void* SonyHttp_PS3::sslPool = nullptr; +void* SonyHttp_PS3::cookiePool = nullptr; CellHttpClientId SonyHttp_PS3::client; CellHttpTransId SonyHttp_PS3::trans; bool SonyHttp_PS3:: bInitialised = false; @@ -22,31 +22,31 @@ bool SonyHttp_PS3:: bInitialised = false; bool SonyHttp_PS3::loadCerts(size_t *numBufPtr, CellHttpsData **caListPtr) { - CellHttpsData *caList = NULL; + CellHttpsData *caList = nullptr; size_t size = 0; int ret = 0; - char *buf = NULL; + char *buf = nullptr; - caList = (CellHttpsData *)malloc(sizeof(CellHttpsData)*2); - if (NULL == caList) { + caList = static_cast(malloc(sizeof(CellHttpsData) * 2)); + if (nullptr == caList) { app.DebugPrintf("failed to malloc cert data"); return false; } - ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, NULL, 0, &size); + ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, nullptr, 0, &size); if (ret < 0) { app.DebugPrintf("cellSslCertifacateLoader() failed(1): 0x%08x", ret); return ret; } - buf = (char*)malloc(size); - if (NULL == buf) { + buf = static_cast(malloc(size)); + if (nullptr == buf) { app.DebugPrintf("failed to malloc cert buffer"); free(caList); return false; } - ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, buf, size, NULL); + ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, buf, size, nullptr); if (ret < 0) { app.DebugPrintf("cellSslCertifacateLoader() failed(2): 0x%08x", ret); free(buf); @@ -72,7 +72,7 @@ bool SonyHttp_PS3::init() /*E startup procedures */ httpPool = malloc(sc_HTTPPoolSize); - if (httpPool == NULL) { + if (httpPool == nullptr) { app.DebugPrintf("failed to malloc libhttp memory pool\n"); return false; } @@ -84,7 +84,7 @@ bool SonyHttp_PS3::init() } cookiePool = malloc(sc_CookiePoolSize); - if (cookiePool == NULL) { + if (cookiePool == nullptr) { app.DebugPrintf("failed to malloc ssl memory pool\n"); return false; } @@ -97,7 +97,7 @@ bool SonyHttp_PS3::init() sslPool = malloc(sc_SSLPoolSize); - if (sslPool == NULL) { + if (sslPool == nullptr) { app.DebugPrintf("failed to malloc ssl memory pool\n"); return false; } @@ -109,7 +109,7 @@ bool SonyHttp_PS3::init() } size_t numBuf = 0; - CellHttpsData *caList = NULL; + CellHttpsData *caList = nullptr; if(!loadCerts(&numBuf, &caList)) return false; @@ -153,18 +153,18 @@ bool SonyHttp_PS3::parseUri(const char* szUri, CellHttpUri& parsedUri) { /*E the main part */ size_t poolSize = 0; - int ret = cellHttpUtilParseUri(NULL, szUri, NULL, 0, &poolSize); + int ret = cellHttpUtilParseUri(nullptr, szUri, nullptr, 0, &poolSize); if (0 > ret) { app.DebugPrintf("error parsing URI... (0x%x)\n\n", ret); return false; } - if (NULL == (uriPool = malloc(poolSize))) + if (nullptr == (uriPool = malloc(poolSize))) { app.DebugPrintf("error mallocing uriPool (%d)\n", poolSize); return false; } - ret = cellHttpUtilParseUri(&parsedUri, szUri, uriPool, poolSize, NULL); + ret = cellHttpUtilParseUri(&parsedUri, szUri, uriPool, poolSize, nullptr); if (0 > ret) { free(uriPool); @@ -185,7 +185,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) size_t localRecv = 0; if(!parseUri(url, uri)) - return NULL; + return nullptr; app.DebugPrintf(" scheme: %s\n", uri.scheme); app.DebugPrintf(" hostname: %s\n", uri.hostname); @@ -199,10 +199,10 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) if (0 > ret) { app.DebugPrintf("failed to create http transaction... (0x%x)\n\n", ret); - return NULL; + return nullptr; } - ret = cellHttpSendRequest(trans, NULL, 0, NULL); + ret = cellHttpSendRequest(trans, nullptr, 0, nullptr); if (0 > ret) { app.DebugPrintf("failed to complete http transaction... (0x%x)\n\n", ret); @@ -219,7 +219,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) app.DebugPrintf("failed to receive http response... (0x%x)\n\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } app.DebugPrintf("Status Code is %d\n", code); } @@ -232,19 +232,19 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) app.DebugPrintf("Only supporting data that has a content length : CELL_HTTP_ERROR_NO_CONTENT_LENGTH\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } else { app.DebugPrintf("error in receiving content length... (0x%x)\n\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } } int bufferSize = length; - char* buffer = (char*)malloc(bufferSize+1); + char* buffer = static_cast(malloc(bufferSize + 1)); recvd = 0; @@ -261,7 +261,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) free(buffer); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } else { diff --git a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp index e1d8dffa..ab7b4770 100644 --- a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp @@ -35,7 +35,11 @@ void SonyRemoteStorage_PS3::npauthhandler(int event, int result, void *arg) { psnTicketSize = result; psnTicket = malloc(psnTicketSize); +<<<<<<< HEAD + if (psnTicket == nullptr) +======= if (psnTicket == NULL) +>>>>>>> origin/main { app.DebugPrintf("Failed to allocate for ticket\n"); } @@ -78,7 +82,7 @@ int SonyRemoteStorage_PS3::initPreconditions() cellSysutilCheckCallback(); sys_timer_usleep(50000); //50 milliseconds. } - if(psnTicket == NULL) + if(psnTicket == nullptr) return -1; return 0; @@ -86,7 +90,7 @@ int SonyRemoteStorage_PS3::initPreconditions() void SonyRemoteStorage_PS3::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) { - ((SonyRemoteStorage_PS3*)userData)->internalCallback(event, retCode); + static_cast(userData)->internalCallback(event, retCode); } void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) @@ -239,7 +243,7 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam) params.timeout.receiveMs = 120 * 1000; //120 seconds is the default params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == NULL) + if(m_memPoolBuffer == nullptr) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; @@ -343,9 +347,9 @@ bool SonyRemoteStorage_PS3::setDataInternal() bool bHostOptionsRead; DWORD uiTexturePack; char seed[22]; - app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); + app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,reinterpret_cast(seed), uiHostOptions, bHostOptionsRead, uiTexturePack); - int64_t iSeed = strtoll(seed,NULL,10); + int64_t iSeed = strtoll(seed, nullptr,10); char seedHex[17]; sprintf(seedHex,"%016llx",iSeed); memcpy(descData.m_seed,seedHex,16); // Don't copy null @@ -430,20 +434,20 @@ void SonyRemoteStorage_PS3::runCallback() int SonyRemoteStorage_PS3::SaveCompressCallback(LPVOID lpParam,bool bRes) { - SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)lpParam; + SonyRemoteStorage_PS3* pRS = static_cast(lpParam); pRS->m_compressedSaveState = e_state_Idle; return 0; } int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bool bIsOwner) { - SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)pParam; + SonyRemoteStorage_PS3* pRS = static_cast(pParam); int origFilesize = StorageManager.GetSaveSize(); void* pOrigSaveData = malloc(origFilesize); unsigned int retFilesize; StorageManager.GetSaveData( pOrigSaveData, &retFilesize ); // check if this save file is already compressed - if(*((int*)pOrigSaveData) != 0) + if(*static_cast(pOrigSaveData) != 0) { app.DebugPrintf("compressing save data\n"); @@ -451,7 +455,7 @@ int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bo // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size unsigned int compLength = origFilesize+8; - byte *compData = (byte *)malloc( compLength ); + byte *compData = static_cast(malloc(compLength)); Compression::UseDefaultThreadStorage(); Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize); ZeroMemory(compData,8); diff --git a/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp b/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp index 41c52bed..7a4d95aa 100644 --- a/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp +++ b/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp @@ -49,7 +49,7 @@ void SonyVoiceChat::init( SQRNetworkManager_PS3* pNetMan ) sm_pNetworkManager = pNetMan; setState(AVC_STATE_CHAT_INIT); - ProfileManager.GetChatAndContentRestrictions(0,false,&sm_isChatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(0,false,&sm_isChatRestricted,nullptr,nullptr); } void SonyVoiceChat::shutdown() @@ -225,11 +225,11 @@ void SonyVoiceChat::eventcb( CellSysutilAvc2EventId event_id, CellSysutilAvc2Eve { CELL_AVC2_EVENT_LEAVE_FAILED, eventcb_leave }, { CELL_AVC2_EVENT_UNLOAD_SUCCEEDED, eventcb_unload }, { CELL_AVC2_EVENT_UNLOAD_FAILED, eventcb_unload }, - { CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED, NULL }, - { CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT, NULL }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED, NULL }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED,NULL }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED, NULL }, + { CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED,nullptr }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED, nullptr }, { CELL_AVC2_EVENT_SYSTEM_VOICE_DETECTED, eventcb_voiceDetected }, }; @@ -258,7 +258,7 @@ int SonyVoiceChat::load() ret = cellSysutilAvc2LoadAsync( sm_pNetworkManager->m_matchingContext, SYS_MEMORY_CONTAINER_ID_INVALID, eventcb, - NULL, + nullptr, &g_chat_avc2param ); if( ret != CELL_OK ) { diff --git a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp index fd8ddd9a..bce76078 100644 --- a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp +++ b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp @@ -16,13 +16,13 @@ static const unsigned int NUM_SUBMIT_JOBS = 128; #define DMA_ALIGNMENT (128) #define JOBHEADER_SYMBOL(JobName) _binary_jqjob_##JobName##_jobbin2_jobheader -C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = NULL; +C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = nullptr; uint16_t C4JSpursJobQueue::Port::s_jobTagBitmask = 0; -C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {nullptr,nullptr,nullptr,nullptr, + nullptr,nullptr,nullptr,nullptr, + nullptr,nullptr,nullptr,nullptr, + nullptr,nullptr,nullptr,nullptr }; bool C4JSpursJobQueue::Port::s_initialised; CRITICAL_SECTION C4JSpursJobQueue::Port::s_lock; @@ -43,7 +43,7 @@ C4JSpursJobQueue::C4JSpursJobQueue() //E create jobQueue pJobQueue = (JobQueue*)memalign(CELL_SPURS_JOBQUEUE_ALIGN, sizeof(JobQueue)); - assert(pJobQueue != NULL); + assert(pJobQueue != nullptr); ret = JobQueue::create( pJobQueue, spurs, @@ -168,7 +168,7 @@ int C4JSpursJobQueue::Port::getFreeJobTag() void C4JSpursJobQueue::Port::releaseJobTag( int tag ) { s_jobTagBitmask &= ~(1< *pJobQueue; public: - static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == NULL) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;} + static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == nullptr) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;} C4JSpursJobQueue(); void shutdown(); diff --git a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp index 94d7ef87..56dd9878 100644 --- a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp +++ b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp @@ -17,7 +17,7 @@ static const bool sc_verbose = true; -cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = NULL; +cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = nullptr; void C4JThread_SPU::initSPURS() { diff --git a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp index 2b0a523f..53a8639d 100644 --- a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp +++ b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp @@ -3,7 +3,7 @@ #include "EdgeZLib.h" #include "edge/zlib/edgezlib_ppu.h" -static CellSpurs* s_pSpurs = NULL; +static CellSpurs* s_pSpurs = nullptr; //Set this to 5 if you want deflate/inflate to run in parallel on 5 SPUs. @@ -12,7 +12,7 @@ const uint32_t kMaxNumDeflateQueueEntries = 64; static CellSpursEventFlag s_eventFlagDeflate; //Cannot be on stack static CellSpursTaskset s_taskSetDeflate; //Cannot be on stack static EdgeZlibDeflateQHandle s_deflateQueue; -static void* s_pDeflateQueueBuffer = NULL; +static void* s_pDeflateQueueBuffer = nullptr; static void* s_pDeflateTaskContext[kNumDeflateTasks]; static uint32_t s_numElementsToCompress; //Cannot be on stack @@ -22,7 +22,7 @@ const uint32_t kMaxNumInflateQueueEntries = 64; static CellSpursEventFlag s_eventFlagInflate; //Cannot be on stack static CellSpursTaskset s_taskSetInflate; //Cannot be on stack static EdgeZlibInflateQHandle s_inflateQueue; -static void* s_pInflateQueueBuffer = NULL; +static void* s_pInflateQueueBuffer = nullptr; static void* s_pInflateTaskContext[kNumInflateTasks]; static uint32_t s_numElementsToDecompress; //Cannot be on stack @@ -195,9 +195,9 @@ bool EdgeZLib::Compress(void* pDestination, uint32_t* pDestSize, const void* pSo // The Deflate Task will wake up and process this work. // ////////////////////////////////////////////////////////////////////////// - uint32_t* pDst = NULL; + uint32_t* pDst = nullptr; bool findingSizeOnly = false; - if(pDestination == NULL && *pDestSize == 0) + if(pDestination == nullptr && *pDestSize == 0) { pDst = (uint32_t*)malloc(SrcSize); findingSizeOnly = true; diff --git a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp index 03d916ab..442aab06 100644 --- a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp +++ b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp @@ -13,18 +13,18 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( (cd = l10n_get_converter( L10N_UTF16, L10N_UTF8 )) == -1 ) { app.DebugPrintf("l10n_get_converter: no such converter\n"); - return NULL; + return nullptr; } - l10n_convert_str( cd, wchString, &src_len, NULL, &dst_len ); - uint8_t *strUtf8=(uint8_t *)malloc(dst_len); + l10n_convert_str( cd, wchString, &src_len, nullptr, &dst_len ); + uint8_t *strUtf8=static_cast(malloc(dst_len)); memset(strUtf8,0,dst_len); result = l10n_convert_str( cd, wchString, &src_len, strUtf8, &dst_len ); if( result != ConversionOK ) { app.DebugPrintf("l10n_convert: conversion error : 0x%x\n", result); - return NULL; + return nullptr; } return strUtf8; diff --git a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp index 4143c555..c11a8593 100644 --- a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp +++ b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp @@ -74,8 +74,8 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src ) wchar_t f,l; // validation section - // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); - // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(dst != nullptr, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(src != nullptr, EINVAL, _NLSCMPERROR); do { f = towlower(*dst); @@ -90,7 +90,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize) { size_t n; -// Note that we do not check if s == NULL, because we do not +// Note that we do not check if s == nullptr, because we do not // return errno_t... for (n = 0; n < maxsize && *wcs; n++, wcs++) @@ -134,7 +134,7 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) lpSystemTime->wMilliseconds = cellRtcGetMicrosecond(&dateTime)/1000; } -HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return NULL; } +HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return nullptr; } VOID Sleep(DWORD dwMilliseconds) { C4JThread::Sleep(dwMilliseconds); @@ -267,8 +267,8 @@ BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { return TLSStoragePS3::In LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) { int err; - sys_addr_t newAddress = NULL; - if(lpAddress == NULL) + sys_addr_t newAddress = nullptr; + if(lpAddress == nullptr) { // reserve, and possibly commit also int commitSize = 0; @@ -382,7 +382,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi int fd = (int) hFile; uint64_t pos = 0, bitsToMove = (int64_t) lDistanceToMove; - if (lpDistanceToMoveHigh != NULL) + if (lpDistanceToMoveHigh != nullptr) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; int whence = 0; @@ -490,7 +490,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, } else { - err = cellFsOpen(filePath, flags, &fd ,NULL, 0); + err = cellFsOpen(filePath, flags, &fd ,nullptr, 0); iFilesOpen++; //printf("\n\nFiles Open - %d\n\n",iFilesOpen); } @@ -675,7 +675,7 @@ errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_ int _wtoi(const wchar_t *_Str) { - return wcstol(_Str, NULL, 10); + return wcstol(_Str, nullptr, 10); } diff --git a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp index e7eca53f..a04e45d9 100644 --- a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp +++ b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp @@ -16,12 +16,12 @@ C4JThread::EventArray *ShutdownManager::s_eventArray[eThreadIdCount]; void ShutdownManager::Initialise() { #ifdef __PS3__ - cellSysutilRegisterCallback( 1, SysUtilCallback, NULL ); + cellSysutilRegisterCallback( 1, SysUtilCallback, nullptr ); for( int i = 0; i < eThreadIdCount; i++ ) { s_threadShouldRun[i] = true; s_threadRunning[i] = 0; - s_eventArray[i] = NULL; + s_eventArray[i] = nullptr; } // Special case for storage manager, which we will manually set now to be considered as running - this will be unset by StorageManager.ExitRequest if required s_threadRunning[eStorageManagerThreads] = true; diff --git a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp index 0906802d..a3b09d6d 100644 --- a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp +++ b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp @@ -4,7 +4,7 @@ -TLSStoragePS3* TLSStoragePS3::m_pInstance = NULL; +TLSStoragePS3* TLSStoragePS3::m_pInstance = nullptr; BOOL TLSStoragePS3::m_activeList[sc_maxSlots]; __thread LPVOID TLSStoragePS3::m_values[sc_maxSlots]; @@ -16,7 +16,7 @@ TLSStoragePS3::TLSStoragePS3() for(int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); // push this into a vector @@ -345,7 +345,7 @@ void CConsoleMinecraftApp::FatalLoadError() } app.DebugPrintf("Requesting Message Box for Fatal Error\n"); - EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0); + EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,nullptr,this,(char *)u8Message,0); while ((eResult==EMsgBox_Busy) || (eResult==EMsgBox_SysUtilBusy)) { @@ -359,7 +359,7 @@ void CConsoleMinecraftApp::FatalLoadError() _Exit(0); } app.DebugPrintf("Requesting Message Box for Fatal Error again due to BUSY\n"); - eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0); + eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,nullptr,this,(char *)u8Message,0); } while(1) @@ -483,7 +483,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -521,7 +521,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() #ifdef SAVE_GAME_TO_LOAD param->saveData = LoadSaveFromDisk(wstring(SAVE_GAME_TO_LOAD)); #else - param->saveData = NULL; + param->saveData = nullptr; #endif app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -728,7 +728,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return NULL; + return nullptr; } return &m_CategoryInfo; @@ -742,10 +742,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=NULL) + if(m_ProductListA!=nullptr) { delete [] m_ProductListA; - m_ProductListA=NULL; + m_ProductListA=nullptr; } m_ProductListRetrievedC=0; @@ -769,7 +769,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -831,7 +831,7 @@ std::vector* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return NULL; + return nullptr; } return &m_ProductListA[iIndex]; @@ -842,7 +842,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle) // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -1181,7 +1181,7 @@ char *PatchFilelist[] = - NULL + nullptr }; bool CConsoleMinecraftApp::IsFileInPatchList(LPCSTR lpFileName) @@ -1226,7 +1226,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=NULL) + if(pCategories!=nullptr) { if(pCategories->countOfProducts>0) { diff --git a/Minecraft.Client/PS3/PS3_App.h b/Minecraft.Client/PS3/PS3_App.h index d1ecdb6f..f9293b6f 100644 --- a/Minecraft.Client/PS3/PS3_App.h +++ b/Minecraft.Client/PS3/PS3_App.h @@ -88,7 +88,7 @@ public: // void SetVoiceChatAndUGCRestricted(bool bRestricted); // bool GetVoiceChatAndUGCRestricted(void); - StringTable *GetStringTable() { return NULL;} + StringTable *GetStringTable() { return nullptr;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/PS3/PS3_Minecraft.cpp b/Minecraft.Client/PS3/PS3_Minecraft.cpp index 82dd7c50..fb987a9e 100644 --- a/Minecraft.Client/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/PS3/PS3_Minecraft.cpp @@ -356,9 +356,9 @@ void MemSect(int sect) #endif -ID3D11Device* g_pd3dDevice = NULL; -ID3D11DeviceContext* g_pImmediateContext = NULL; -IDXGISwapChain* g_pSwapChain = NULL; +ID3D11Device* g_pd3dDevice = nullptr; +ID3D11DeviceContext* g_pImmediateContext = nullptr; +IDXGISwapChain* g_pSwapChain = nullptr; bool g_bBootedFromInvite = false; //-------------------------------------------------------------------------------------- @@ -420,7 +420,7 @@ static void * load_file( char const * name ) void debugSaveGameDirect() { - C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, NULL, "debugSaveGameDirect"); + C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, nullptr, "debugSaveGameDirect"); thread->Run(); thread->WaitForCompletion(1000); } @@ -447,7 +447,7 @@ int simpleMessageBoxCallback( UINT uiTitle, UINT uiText, ui.RequestMessageBox( uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, app.GetStringTable(), - NULL, 0 + nullptr, 0 ); return 0; @@ -633,7 +633,7 @@ int LoadSysModules() DEBUG_PRINTF("contentInfoPath - %s\n",contentInfoPath); DEBUG_PRINTF("usrdirPath - %s\n",usrdirPath); - ret=cellGamePatchCheck(&sizeBD,NULL); + ret=cellGamePatchCheck(&sizeBD,nullptr); if(ret < 0) { DEBUG_PRINTF("cellGamePatchCheck() Error: 0x%x\n", ret); @@ -839,7 +839,7 @@ int main() else ui.init(1280,480); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -862,7 +862,7 @@ int main() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -977,24 +977,24 @@ int main() free(szTemp); StorageManager.SetDefaultImages((PBYTE)baOptionsIcon.data, baOptionsIcon.length,(PBYTE)baSaveImage.data, baSaveImage.length,(PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); - if(baOptionsIcon.data!=NULL) + if(baOptionsIcon.data!=nullptr) { delete [] baOptionsIcon.data; } - if(baSaveThumbnail.data!=NULL) + if(baSaveThumbnail.data!=nullptr) { delete [] baSaveThumbnail.data; } - if(baSaveImage.data!=NULL) + if(baSaveImage.data!=nullptr) { delete [] baSaveImage.data; } wstring wsName=L"Graphics\\SaveChest.png"; byteArray baSaveLoadIcon = app.getArchiveFile(wsName); - if(baSaveLoadIcon.data!=NULL) + if(baSaveLoadIcon.data!=nullptr) { StorageManager.SetSaveLoadIcon((PBYTE)baSaveLoadIcon.data, baSaveLoadIcon.length); delete [] baSaveLoadIcon.data; @@ -1039,7 +1039,7 @@ int main() }*/ // set the achievement text for a trial achievement, now we have the string table loaded - ProfileManager.SetTrialTextStringTable(NULL, IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL); + ProfileManager.SetTrialTextStringTable(nullptr, IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL); ProfileManager.SetTrialAwardText(eAwardType_Achievement,IDS_UNLOCK_TITLE,IDS_UNLOCK_ACHIEVEMENT_TEXT); #ifndef __PS3__ ProfileManager.SetTrialAwardText(eAwardType_GamerPic,IDS_UNLOCK_TITLE,IDS_UNLOCK_GAMERPIC_TEXT); @@ -1109,7 +1109,7 @@ int main() // It's ok to do this for the primary PSN player here - it has this data locally. All other players need to do it on PSN sign in. // bool bChatRestricted=false; -// ProfileManager.GetChatAndContentRestrictions(0,&bChatRestricted,NULL,NULL); +// ProfileManager.GetChatAndContentRestrictions(0,&bChatRestricted,nullptr,nullptr); // 4J-PB - really want to wait until we've read the options, so we can set the right language if they've chosen one other than the default // bool bOptionsRead=false; @@ -1198,7 +1198,7 @@ int main() else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1369,7 +1369,7 @@ vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != NULL ) + if( strUtf8 != nullptr ) { vRichPresenceStrings.push_back(strUtf8); } @@ -1379,7 +1379,7 @@ uint8_t * AddRichPresenceString(int iID) void FreeRichPresenceStrings() { uint8_t *strUtf8; - for(int i=0;igetData(x, y, z); int dir = data & 7; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h index 07eb3d86..e617e84c 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h @@ -5,7 +5,7 @@ class CakeTile_SPU : public Tile_SPU { public: CakeTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int d = level->getData(x, y, z); float r = 1 / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h index 2854b48b..199fceb6 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h @@ -6,7 +6,7 @@ class CauldronTile_SPU : public Tile_SPU { public: CauldronTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } //@Override // virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel = false) { return false; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp index 1cb5e2ee..ac71c572 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp @@ -241,12 +241,12 @@ void ChunkRebuildData::createTileData() m_tileData.signalSource.set(i, Tile::tiles[i]->isSignalSource()); m_tileData.cubeShaped.set(i, Tile::tiles[i]->isCubeShaped()); - m_tileData.xx0[i] = (float)Tile::tiles[i]->getShapeX0(); - m_tileData.yy0[i] = (float)Tile::tiles[i]->getShapeY0(); - m_tileData.zz0[i] = (float)Tile::tiles[i]->getShapeZ0(); - m_tileData.xx1[i] = (float)Tile::tiles[i]->getShapeX1(); - m_tileData.yy1[i] = (float)Tile::tiles[i]->getShapeY1(); - m_tileData.zz1[i] = (float)Tile::tiles[i]->getShapeZ1(); + m_tileData.xx0[i] = static_cast(Tile::tiles[i]->getShapeX0()); + m_tileData.yy0[i] = static_cast(Tile::tiles[i]->getShapeY0()); + m_tileData.zz0[i] = static_cast(Tile::tiles[i]->getShapeZ0()); + m_tileData.xx1[i] = static_cast(Tile::tiles[i]->getShapeX1()); + m_tileData.yy1[i] = static_cast(Tile::tiles[i]->getShapeY1()); + m_tileData.zz1[i] = static_cast(Tile::tiles[i]->getShapeZ1()); Icon* pTex = Tile::tiles[i]->icon; if(pTex) { @@ -269,17 +269,17 @@ void ChunkRebuildData::createTileData() setIconSPUFromIcon(&m_tileData.grass_iconSideOverlay, Tile::grass->iconSideOverlay); // ThinFence - setIconSPUFromIcon(&m_tileData.ironFence_EdgeTexture, ((ThinFenceTile*)Tile::ironFence)->getEdgeTexture()); - setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, ((ThinFenceTile*)Tile::thinGlass)->getEdgeTexture()); + setIconSPUFromIcon(&m_tileData.ironFence_EdgeTexture, static_cast(Tile::ironFence)->getEdgeTexture()); + setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, static_cast(Tile::thinGlass)->getEdgeTexture()); //FarmTile - setIconSPUFromIcon(&m_tileData.farmTile_Dry, ((FarmTile*)Tile::farmland)->iconDry); - setIconSPUFromIcon(&m_tileData.farmTile_Wet, ((FarmTile*)Tile::farmland)->iconWet); + setIconSPUFromIcon(&m_tileData.farmTile_Dry, static_cast(Tile::farmland)->iconDry); + setIconSPUFromIcon(&m_tileData.farmTile_Wet, static_cast(Tile::farmland)->iconWet); // DoorTile for(int i=0;i<8; i++) { - setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], ((DoorTile*)Tile::door_wood)->icons[i]); + setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], static_cast(Tile::door_wood)->icons[i]); // we're not supporting flipped icons, so manually flip here if(i>=4) m_tileData.doorTile_Icons[i].flipHorizontal(); @@ -291,20 +291,20 @@ void ChunkRebuildData::createTileData() // SandStoneTile for(int i=0;i<3; i++) - setIconSPUFromIcon(&m_tileData.sandStone_icons[i], ((SandStoneTile*)Tile::sandStone)->icons[i]); - setIconSPUFromIcon(&m_tileData.sandStone_iconTop, ((SandStoneTile*)Tile::sandStone)->iconTop); - setIconSPUFromIcon(&m_tileData.sandStone_iconBottom, ((SandStoneTile*)Tile::sandStone)->iconBottom); + setIconSPUFromIcon(&m_tileData.sandStone_icons[i], static_cast(Tile::sandStone)->icons[i]); + setIconSPUFromIcon(&m_tileData.sandStone_iconTop, static_cast(Tile::sandStone)->iconTop); + setIconSPUFromIcon(&m_tileData.sandStone_iconBottom, static_cast(Tile::sandStone)->iconBottom); // WoodTile // assert(WoodTile_SPU::WOOD_NAMES_LENGTH == 4); for(int i=0;i<4; i++) - setIconSPUFromIcon(&m_tileData.woodTile_icons[i], ((WoodTile*)Tile::wood)->icons[i]); + setIconSPUFromIcon(&m_tileData.woodTile_icons[i], static_cast(Tile::wood)->icons[i]); // TreeTile // assert(TreeTile_SPU::TREE_NAMES_LENGTH == 4); for(int i=0;i<4; i++) - setIconSPUFromIcon(&m_tileData.treeTile_icons[i], ((TreeTile*)Tile::treeTrunk)->icons[i]); - setIconSPUFromIcon(&m_tileData.treeTile_iconTop, ((TreeTile*)Tile::treeTrunk)->iconTop); + setIconSPUFromIcon(&m_tileData.treeTile_icons[i], static_cast(Tile::treeTrunk)->icons[i]); + setIconSPUFromIcon(&m_tileData.treeTile_iconTop, static_cast(Tile::treeTrunk)->iconTop); // LeafTile for(int i=0;i<2; i++) @@ -313,12 +313,12 @@ void ChunkRebuildData::createTileData() // CropTile for(int i=0;i<8; i++) - setIconSPUFromIcon(&m_tileData.cropTile_icons[i], ((CropTile*)Tile::crops)->icons[i]); + setIconSPUFromIcon(&m_tileData.cropTile_icons[i], static_cast(Tile::crops)->icons[i]); // FurnaceTile - setIconSPUFromIcon(&m_tileData.furnaceTile_iconTop, ((FurnaceTile*)Tile::furnace)->iconTop); - setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront, ((FurnaceTile*)Tile::furnace)->iconFront); - setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront_lit, ((FurnaceTile*)Tile::furnace_lit)->iconFront); + setIconSPUFromIcon(&m_tileData.furnaceTile_iconTop, static_cast(Tile::furnace)->iconTop); + setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront, static_cast(Tile::furnace)->iconFront); + setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront_lit, static_cast(Tile::furnace_lit)->iconFront); //LiquidTile setIconSPUFromIcon(&m_tileData.liquidTile_iconWaterStill, (Tile::water)->icons[0]); @@ -332,64 +332,64 @@ void ChunkRebuildData::createTileData() // Sapling for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.sapling_icons[i], ((Sapling*)Tile::sapling)->icons[i]); + setIconSPUFromIcon(&m_tileData.sapling_icons[i], static_cast(Tile::sapling)->icons[i]); - m_tileData.glassTile_allowSame = ((GlassTile*)Tile::glass)->allowSame; - m_tileData.iceTile_allowSame = ((IceTile*)Tile::ice)->allowSame; + m_tileData.glassTile_allowSame = static_cast(Tile::glass)->allowSame; + m_tileData.iceTile_allowSame = static_cast(Tile::ice)->allowSame; // DispenserTile - setIconSPUFromIcon(&m_tileData.dispenserTile_iconTop, ((DispenserTile*)Tile::dispenser)->iconTop); - setIconSPUFromIcon(&m_tileData.dispenserTile_iconFront, ((DispenserTile*)Tile::dispenser)->iconFront); - setIconSPUFromIcon(&m_tileData.dispenserTile_iconFrontVertical, ((DispenserTile*)Tile::dispenser)->iconFrontVertical); + setIconSPUFromIcon(&m_tileData.dispenserTile_iconTop, static_cast(Tile::dispenser)->iconTop); + setIconSPUFromIcon(&m_tileData.dispenserTile_iconFront, static_cast(Tile::dispenser)->iconFront); + setIconSPUFromIcon(&m_tileData.dispenserTile_iconFrontVertical, static_cast(Tile::dispenser)->iconFrontVertical); // RailTile - setIconSPUFromIcon(&m_tileData.railTile_iconTurn, ((RailTile*)Tile::rail)->iconTurn); - setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, ((RailTile*)Tile::goldenRail)->iconTurn); + setIconSPUFromIcon(&m_tileData.railTile_iconTurn, static_cast(Tile::rail)->iconTurn); + setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, static_cast(Tile::goldenRail)->iconTurn); for(int i=0;i<2;i++) - setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], ((DetectorRailTile*)Tile::detectorRail)->icons[i]); + setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], static_cast(Tile::detectorRail)->icons[i]); // tntTile - setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, ((TntTile*)Tile::tnt)->iconBottom); - setIconSPUFromIcon(&m_tileData.tntTile_iconTop, ((TntTile*)Tile::tnt)->iconTop); + setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, static_cast(Tile::tnt)->iconBottom); + setIconSPUFromIcon(&m_tileData.tntTile_iconTop, static_cast(Tile::tnt)->iconTop); // workbenchTile - setIconSPUFromIcon(&m_tileData.workBench_iconFront, ((WorkbenchTile*)Tile::workBench)->iconFront); - setIconSPUFromIcon(&m_tileData.workBench_iconTop, ((WorkbenchTile*)Tile::workBench)->iconTop); + setIconSPUFromIcon(&m_tileData.workBench_iconFront, static_cast(Tile::workBench)->iconFront); + setIconSPUFromIcon(&m_tileData.workBench_iconTop, static_cast(Tile::workBench)->iconTop); // cactusTile - setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, ((CactusTile*)Tile::cactus)->iconTop); - setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, ((CactusTile*)Tile::cactus)->iconBottom); + setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, static_cast(Tile::cactus)->iconTop); + setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, static_cast(Tile::cactus)->iconBottom); // recordPlayer - setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, ((RecordPlayerTile*)Tile::recordPlayer)->iconTop); + setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, static_cast(Tile::recordPlayer)->iconTop); // pumpkin - setIconSPUFromIcon(&m_tileData.pumpkinTile_iconTop, ((PumpkinTile*)Tile::pumpkin)->iconTop); - setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFace, ((PumpkinTile*)Tile::pumpkin)->iconFace); - setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFaceLit, ((PumpkinTile*)Tile::litPumpkin)->iconFace); + setIconSPUFromIcon(&m_tileData.pumpkinTile_iconTop, static_cast(Tile::pumpkin)->iconTop); + setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFace, static_cast(Tile::pumpkin)->iconFace); + setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFaceLit, static_cast(Tile::litPumpkin)->iconFace); // cakeTile - setIconSPUFromIcon(&m_tileData.cakeTile_iconTop, ((CakeTile*)Tile::cake)->iconTop); - setIconSPUFromIcon(&m_tileData.cakeTile_iconBottom, ((CakeTile*)Tile::cake)->iconBottom); - setIconSPUFromIcon(&m_tileData.cakeTile_iconInner, ((CakeTile*)Tile::cake)->iconInner); + setIconSPUFromIcon(&m_tileData.cakeTile_iconTop, static_cast(Tile::cake)->iconTop); + setIconSPUFromIcon(&m_tileData.cakeTile_iconBottom, static_cast(Tile::cake)->iconBottom); + setIconSPUFromIcon(&m_tileData.cakeTile_iconInner, static_cast(Tile::cake)->iconInner); // SmoothStoneBrickTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], ((SmoothStoneBrickTile*)Tile::stoneBrickSmooth)->icons[i]); + setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], static_cast(Tile::stoneBrickSmooth)->icons[i]); // HugeMushroomTile for(int i=0;i<2;i++) - setIconSPUFromIcon(&m_tileData.hugeMushroom_icons[i], ((HugeMushroomTile*)Tile::hugeMushroom1)->icons[i]); - setIconSPUFromIcon(&m_tileData.hugeMushroom_iconStem, ((HugeMushroomTile*)Tile::hugeMushroom1)->iconStem); - setIconSPUFromIcon(&m_tileData.hugeMushroom_iconInside, ((HugeMushroomTile*)Tile::hugeMushroom1)->iconInside); + setIconSPUFromIcon(&m_tileData.hugeMushroom_icons[i], static_cast(Tile::hugeMushroom1)->icons[i]); + setIconSPUFromIcon(&m_tileData.hugeMushroom_iconStem, static_cast(Tile::hugeMushroom1)->iconStem); + setIconSPUFromIcon(&m_tileData.hugeMushroom_iconInside, static_cast(Tile::hugeMushroom1)->iconInside); // MelonTile - setIconSPUFromIcon(&m_tileData.melonTile_iconTop, ((MelonTile*)Tile::melon)->iconTop); + setIconSPUFromIcon(&m_tileData.melonTile_iconTop, static_cast(Tile::melon)->iconTop); // StemTile - setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, ((StemTile*)Tile::melonStem)->iconAngled); + setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, static_cast(Tile::melonStem)->iconAngled); // MycelTile setIconSPUFromIcon(&m_tileData.mycelTile_iconTop, (Tile::mycel)->iconTop); @@ -397,14 +397,14 @@ void ChunkRebuildData::createTileData() // NetherStalkTile for(int i=0;i<3;i++) - setIconSPUFromIcon(&m_tileData.netherStalk_icons[i], ((NetherStalkTile*)Tile::netherStalk)->icons[i]); + setIconSPUFromIcon(&m_tileData.netherStalk_icons[i], static_cast(Tile::netherStalk)->icons[i]); // EnchantmentTableTile - setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, ((EnchantmentTableTile*)Tile::enchantTable)->iconTop); - setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, ((EnchantmentTableTile*)Tile::enchantTable)->iconBottom); + setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, static_cast(Tile::enchantTable)->iconTop); + setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, static_cast(Tile::enchantTable)->iconBottom); //BrewingStandTile - setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, ((BrewingStandTile*)Tile::brewingStand)->iconBase); + setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, static_cast(Tile::brewingStand)->iconBase); //RedStoneDust setIconSPUFromIcon(&m_tileData.redStoneDust_iconCross, (Tile::redStoneDust)->iconCross); @@ -412,32 +412,32 @@ void ChunkRebuildData::createTileData() setIconSPUFromIcon(&m_tileData.redStoneDust_iconCrossOver, (Tile::redStoneDust)->iconCrossOver); setIconSPUFromIcon(&m_tileData.redStoneDust_iconLineOver, (Tile::redStoneDust)->iconLineOver); - setIconSPUFromIcon(&m_tileData.stoneSlab_iconSide, ((StoneSlabTile*)(Tile::stoneSlab))->iconSide); + setIconSPUFromIcon(&m_tileData.stoneSlab_iconSide, static_cast(Tile::stoneSlab)->iconSide); for(int i=0;i<16;i++) - setIconSPUFromIcon(&m_tileData.clothTile_icons[i], ((ClothTile*)Tile::cloth)->icons[i]); + setIconSPUFromIcon(&m_tileData.clothTile_icons[i], static_cast(Tile::cloth)->icons[i]); // CarrotTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.carrot_icons[i], ((CarrotTile*)Tile::carrots)->icons[i]); + setIconSPUFromIcon(&m_tileData.carrot_icons[i], static_cast(Tile::carrots)->icons[i]); // PotatoTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.potato_icons[i], ((PotatoTile*)Tile::potatoes)->icons[i]); + setIconSPUFromIcon(&m_tileData.potato_icons[i], static_cast(Tile::potatoes)->icons[i]); // AnvilTile for(int i=0;i<3;i++) - setIconSPUFromIcon(&m_tileData.anvil_icons[i], ((AnvilTile*)Tile::anvil)->icons[i]); + setIconSPUFromIcon(&m_tileData.anvil_icons[i], static_cast(Tile::anvil)->icons[i]); // QuartzBlockTile for(int i=0;i<5;i++) - setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], ((QuartzBlockTile*)Tile::quartzBlock)->icons[i]); + setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], static_cast(Tile::quartzBlock)->icons[i]); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconChiseledTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconChiseledTop); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconLinesTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconLinesTop); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconTop); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconBottom, ((QuartzBlockTile*)Tile::quartzBlock)->iconBottom); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconChiseledTop, static_cast(Tile::quartzBlock)->iconChiseledTop); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconLinesTop, static_cast(Tile::quartzBlock)->iconLinesTop); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconTop, static_cast(Tile::quartzBlock)->iconTop); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconBottom, static_cast(Tile::quartzBlock)->iconBottom); } // extern int g_lastHitBlockX; @@ -696,7 +696,7 @@ bool ChunkRebuildData::isEmptyTile(int x, int y, int z) bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z) { TileRef_SPU tile(getTile(x,y,z)); - if (tile.getPtr() == NULL) return false; + if (tile.getPtr() == nullptr) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so @@ -727,7 +727,7 @@ bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z) bool ChunkRebuildData::isSolidBlockingTile(int x, int y, int z) { TileRef_SPU tile(getTile(x, y, z)); - if (tile.getPtr() == NULL) return false; + if (tile.getPtr() == nullptr) return false; bool ret = tile->getMaterial()->blocksMotion() && tile->isCubeShaped(); return ret; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h index f6671db4..2fcb1514 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h @@ -24,7 +24,7 @@ public: virtual bool blocksLight() { return false; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return Tile_SPU::SHAPE_DOOR; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param int getDir(ChunkRebuildData *level, int x, int y, int z); bool isOpen(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h index 6e86d1f0..5e99cc32 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h @@ -12,7 +12,7 @@ public: Icon_SPU *getTexture(int face, int data) { return TileRef_SPU(wood_Id)->getTexture(face); } static int getDirection(int data) { return (data & DIRECTION_MASK); } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param // Brought forward from 1.2.3 + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param // Brought forward from 1.2.3 { int data = getDirection(level->getData(x, y, z)); if (data == Direction::NORTH || data == Direction::SOUTH) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp index fcb3baef..63c206d1 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp @@ -59,7 +59,7 @@ bool FenceTile_SPU::connectsTo(ChunkRebuildData *level, int x, int y, int z) return true; } TileRef_SPU tileInstance(tile); - if (tileInstance.getPtr() != NULL) + if (tileInstance.getPtr() != nullptr) { if (tileInstance->getMaterial()->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h index 50a775fb..bed2e3b7 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h @@ -5,7 +5,7 @@ class FenceTile_SPU : public Tile_SPU { public: FenceTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual bool blocksLight(); virtual bool isSolidRender(bool isServerLevel = false); virtual int getRenderShape(); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp index 1cf83821..1dba9757 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp @@ -3,7 +3,7 @@ #include "Facing_SPU.h" #include "ChunkRebuildData.h" -void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = NULL */) +void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = nullptr */) { if (fullSize()) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h index fd525e96..c89581ad 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h @@ -9,7 +9,7 @@ public: static const int TOP_SLOT_BIT = 8; HalfSlabTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel); virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h index f4ba6ccf..0597c1fc 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h @@ -24,29 +24,29 @@ public: void set(int16_t _x, int16_t _y, int16_t _w, int16_t _h, int texWidth, int texHeight) { - x0 = (int16_t)(4096 * (float(_x) / texWidth)); - y0 = (int16_t)(4096 * (float(_y) / texHeight)); - x1 = x0 + (int16_t)(4096 * (float(_w) / texWidth)); - y1 = y0 + (int16_t)(4096 * (float(_h) / texHeight)); + x0 = static_cast(4096 * (float(_x) / texWidth)); + y0 = static_cast(4096 * (float(_y) / texHeight)); + x1 = x0 + static_cast(4096 * (float(_w) / texWidth)); + y1 = y0 + static_cast(4096 * (float(_h) / texHeight)); } void flipHorizontal() { int16_t temp = x0; x0 = x1; x1 = temp; } void flipVertical() { int16_t temp = y0; y0 = y1; y1 = temp; } - float getU0() const { return (float(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); } - float getU1() const { return (float(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); } + float getU0() const { return (static_cast(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); } + float getU1() const { return (static_cast(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); } float getU(double offset) const { float diff = getU1() - getU0(); - return getU0() + (diff * ((float) offset / 16));//SharedConstants::WORLD_RESOLUTION)); + return getU0() + (diff * (static_cast(offset) / 16));//SharedConstants::WORLD_RESOLUTION)); } - float getV0() const { return (float(y0) / 4096.0f) + UVAdjust; } //sc_texHeight) + getVAdjust(); } - float getV1() const { return (float(y1) / 4096.0f) - UVAdjust; } //sc_texHeight) - getVAdjust(); } + float getV0() const { return (static_cast(y0) / 4096.0f) + UVAdjust; } //sc_texHeight) + getVAdjust(); } + float getV1() const { return (static_cast(y1) / 4096.0f) - UVAdjust; } //sc_texHeight) - getVAdjust(); } float getV(double offset) const { float diff = getV1() - getV0(); - return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION)); + return getV0() + (diff * (static_cast(offset) / 16)); //SharedConstants::WORLD_RESOLUTION)); } // virtual wstring getName() const = 0; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp index 7f13fd4f..fa075e71 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp @@ -211,12 +211,12 @@ double LiquidTile_SPU::getSlopeAngle(ChunkRebuildData *level, int x, int y, int if (m->getID() == Material_SPU::water_Id) { TileRef_SPU tRef(Tile_SPU::water_Id); - flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z); + flow = static_cast(tRef.getPtr())->getFlow(level, x, y, z); } if (m->getID() == Material_SPU::lava_Id) { TileRef_SPU tRef(Tile_SPU::lava_Id); - flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z); + flow = static_cast(tRef.getPtr())->getFlow(level, x, y, z); } if (flow.x == 0 && flow.z == 0) return -1000; return atan2(flow.z, flow.x) - MATH_PI / 2; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h index e8411c88..81ba68c1 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h @@ -8,7 +8,7 @@ class PistonBaseTile_SPU : public Tile_SPU public: PistonBaseTile_SPU(int id) : Tile_SPU(id) {} // virtual void updateShape(float x0, float y0, float z0, float x1, float y1, float z1); - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual int getRenderShape() { return SHAPE_PISTON_BASE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h index d5460492..ee559eff 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h @@ -6,7 +6,7 @@ class PistonExtensionTile_SPU : public Tile_SPU public: PistonExtensionTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual int getRenderShape() { return SHAPE_PISTON_EXTENSION; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } // virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h index 48fc52e9..6ea12648 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h @@ -10,7 +10,7 @@ public: virtual int getRenderShape() { return SHAPE_INVISIBLE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { // should never get here. } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h index f01313a1..a5a4652d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h @@ -5,7 +5,7 @@ class PortalTile_SPU : public HalfTransparentTile_SPU { public: PortalTile_SPU(int id): HalfTransparentTile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { if (level->getTile(x - 1, y, z) == id || level->getTile(x + 1, y, z) == id) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h index 133ec52e..6742e6f6 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h @@ -16,6 +16,6 @@ public: virtual bool isSolidRender(bool isServerLevel = false); virtual bool blocksLight(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); }; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h index 615ebec9..2f8639d4 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h @@ -10,7 +10,7 @@ public: RailTile_SPU(int id) : Tile_SPU(id) {} virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int data = level->getData(x, y, z); if (data >= 2 && data <= 5) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h index 0e461118..218cbd64 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h @@ -26,7 +26,7 @@ public: case TEXTURE_CROSS_OVERLAY: return &ms_pTileData->redStoneDust_iconCrossOver; case TEXTURE_LINE_OVERLAY: return &ms_pTileData->redStoneDust_iconLineOver; } - return NULL; + return nullptr; } static bool shouldConnectTo(ChunkRebuildData *level, int x, int y, int z, int direction) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h index 7fe54d99..74bdb95d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h @@ -16,7 +16,7 @@ public: } Icon_SPU *getTexture(int face, int data){ return TileRef_SPU(wood_Id)->getTexture(face); } - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { if (onGround()) return; int face = level->getData(x, y, z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h index eefa36b2..ca5ba279 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h @@ -15,7 +15,7 @@ public: public: StairTile_SPU(int id) : Tile_SPU(id) {} - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param bool isSolidRender(bool isServerLevel = false); int getRenderShape(); void setBaseShape(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h index 89cd3739..4923e862 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h @@ -35,7 +35,7 @@ public: this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { ms_pTileData->yy1[id] = (level->getData(x, y, z) * 2 + 2) / 16.0f; float ss = 0.125f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp index 3d1007af..efcd44f0 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp @@ -68,7 +68,7 @@ typedef unsigned short hfloat; hfloat convertFloatToHFloat(float f) { unsigned int x = *(unsigned int *)&f; - unsigned int sign = (unsigned short)(x >> 31); + unsigned int sign = static_cast(x >> 31); unsigned int mantissa; unsigned int exp; hfloat hf; @@ -90,8 +90,8 @@ hfloat convertFloatToHFloat(float f) // 16-bit half-float representation stores number as Inf mantissa = 0; } - hf = (((hfloat)sign) << 15) | (hfloat)(HALF_FLOAT_MAX_BIASED_EXP) | - (hfloat)(mantissa >> 13); + hf = (static_cast(sign) << 15) | static_cast(HALF_FLOAT_MAX_BIASED_EXP) | + static_cast(mantissa >> 13); } // check if exponent is <= -15 else if (exp <= HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) @@ -101,13 +101,13 @@ hfloat convertFloatToHFloat(float f) exp = (HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP - exp) >> 23; mantissa >>= (14 + exp); - hf = (((hfloat)sign) << 15) | (hfloat)(mantissa); + hf = (static_cast(sign) << 15) | static_cast(mantissa); } else { - hf = (((hfloat)sign) << 15) | - (hfloat)((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) | - (hfloat)(mantissa >> 13); + hf = (static_cast(sign) << 15) | + static_cast((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) | + static_cast(mantissa >> 13); } return hf; @@ -115,8 +115,8 @@ hfloat convertFloatToHFloat(float f) float convertHFloatToFloat(hfloat hf) { - unsigned int sign = (unsigned int)(hf >> 15); - unsigned int mantissa = (unsigned int)(hf & ((1 << 10) - 1)); + unsigned int sign = static_cast(hf >> 15); + unsigned int mantissa = static_cast(hf & ((1 << 10) - 1)); unsigned int exp = (unsigned int)(hf & HALF_FLOAT_MAX_BIASED_EXP); unsigned int f; @@ -170,7 +170,7 @@ float convertHFloatToFloat(hfloat hf) // Tesselator_SPU *Tesselator_SPU::getInstance() { - return NULL; + return nullptr; // return (Tesselator_SPU *)TlsGetValue(tlsIdx); } @@ -329,12 +329,12 @@ void Tesselator_SPU::tex2(int tex2) void Tesselator_SPU::color(float r, float g, float b) { - color((int) (r * 255), (int) (g * 255), (int) (b * 255)); + color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255)); } void Tesselator_SPU::color(float r, float g, float b, float a) { - color((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)); + color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255), static_cast(a * 255)); } void Tesselator_SPU::color(int r, int g, int b) @@ -539,7 +539,7 @@ void Tesselator_SPU::vertex(float x, float y, float z) // see comments in packCompactQuad() for exact format if( useCompactFormat360 ) { - unsigned int ucol = (unsigned int)col; + unsigned int ucol = static_cast(col); #ifdef _XBOX // Pack as 4:4:4 RGB_ @@ -564,7 +564,7 @@ void Tesselator_SPU::vertex(float x, float y, float z) unsigned short packedcol = ((col & 0xf8000000 ) >> 16 ) | ((col & 0x00fc0000 ) >> 13 ) | ((col & 0x0000f800 ) >> 11 ); - int ipackedcol = ((int)packedcol) & 0xffff; // 0 to 65535 range + int ipackedcol = static_cast(packedcol) & 0xffff; // 0 to 65535 range ipackedcol -= 32768; // -32768 to 32767 range ipackedcol &= 0xffff; @@ -597,12 +597,12 @@ void Tesselator_SPU::vertex(float x, float y, float z) pShortData[7] = ((INT_ROUND(tex2V * (8192.0f/256.0f)))&0xffff); incData(4); #else - pShortData[0] = (((int)((x + xo ) * 1024.0f))&0xffff); - pShortData[1] = (((int)((y + yo ) * 1024.0f))&0xffff); - pShortData[2] = (((int)((z + zo ) * 1024.0f))&0xffff); + pShortData[0] = (static_cast((x + xo) * 1024.0f)&0xffff); + pShortData[1] = (static_cast((y + yo) * 1024.0f)&0xffff); + pShortData[2] = (static_cast((z + zo) * 1024.0f)&0xffff); pShortData[3] = ipackedcol; - pShortData[4] = (((int)(uu * 8192.0f))&0xffff); - pShortData[5] = (((int)(v * 8192.0f))&0xffff); + pShortData[4] = (static_cast(uu * 8192.0f)&0xffff); + pShortData[5] = (static_cast(v * 8192.0f)&0xffff); pShortData[6] = ((int16_t*)&_tex2)[0]; pShortData[7] = ((int16_t*)&_tex2)[1]; incData(4); @@ -723,9 +723,9 @@ void Tesselator_SPU::noColor() void Tesselator_SPU::normal(float x, float y, float z) { hasNormal = true; - byte xx = (byte) (x * 127); - byte yy = (byte) (y * 127); - byte zz = (byte) (z * 127); + byte xx = static_cast(x * 127); + byte yy = static_cast(y * 127); + byte zz = static_cast(z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h index 8aab31a3..87d87bcf 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h @@ -5,7 +5,7 @@ class TheEndPortalFrameTile_SPU : public Tile_SPU { public: TheEndPortalFrameTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return SHAPE_PORTAL_FRAME; } // virtual void updateDefaultShape(); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp index 20393f6e..9e7d30de 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp @@ -74,7 +74,7 @@ Icon_SPU *ThinFenceTile_SPU::getEdgeTexture() #ifndef SN_TARGET_PS3_SPU assert(0); #endif - return NULL; + return nullptr; } bool ThinFenceTile_SPU::attachsTo(int tile) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h index 61c39201..8f7b601b 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h @@ -11,7 +11,7 @@ public: virtual int getRenderShape(); virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); virtual void updateDefaultShape(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual Icon_SPU *getEdgeTexture(); bool attachsTo(int tile); }; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp index ab9b2c94..22c3a26d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp @@ -71,7 +71,7 @@ const float smallUV = ( 1.0f / 16.0f ); void TileRenderer_SPU::_init() { - fixedTexture = NULL; + fixedTexture = nullptr; xFlipTexture = false; noCulling = false; blsmooth = 1; @@ -103,7 +103,7 @@ TileRenderer_SPU::TileRenderer_SPU( ChunkRebuildData* level ) TileRenderer_SPU::TileRenderer_SPU() { - this->level = NULL; + this->level = nullptr; _init(); } @@ -122,12 +122,12 @@ void TileRenderer_SPU::setFixedTexture( Icon_SPU *fixedTexture ) void TileRenderer_SPU::clearFixedTexture() { - this->fixedTexture = NULL; + this->fixedTexture = nullptr; } bool TileRenderer_SPU::hasFixedTexture() { - return fixedTexture != NULL; + return fixedTexture != nullptr; } void TileRenderer_SPU::setShape(float x0, float y0, float z0, float x1, float y1, float z1) @@ -270,7 +270,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateStemInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_LILYPAD: - retVal = tesselateLilypadInWorld( (WaterlilyTile_SPU*)tt, x, y, z ); + retVal = tesselateLilypadInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_ROWS: retVal = tesselateRowInWorld( tt, x, y, z ); @@ -279,7 +279,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateTorchInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_FIRE: - retVal = tesselateFireInWorld( (FireTile_SPU *)tt, x, y, z ); + retVal = tesselateFireInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_RED_DUST: retVal = tesselateDustInWorld( tt, x, y, z ); @@ -291,19 +291,19 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateDoorInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_RAIL: - retVal = tesselateRailInWorld( ( RailTile_SPU* )tt, x, y, z ); + retVal = tesselateRailInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_STAIRS: - retVal = tesselateStairsInWorld( (StairTile_SPU *)tt, x, y, z ); + retVal = tesselateStairsInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_EGG: - retVal = tesselateEggInWorld((EggTile_SPU*) tt, x, y, z); + retVal = tesselateEggInWorld(static_cast(tt), x, y, z); break; case Tile_SPU::SHAPE_FENCE: - retVal = tesselateFenceInWorld( ( FenceTile_SPU* )tt, x, y, z ); + retVal = tesselateFenceInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_WALL: - retVal = tesselateWallInWorld( (WallTile_SPU *) tt, x, y, z); + retVal = tesselateWallInWorld( static_cast(tt), x, y, z); break; case Tile_SPU::SHAPE_LEVER: retVal = tesselateLeverInWorld( tt, x, y, z ); @@ -318,7 +318,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateBedInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_DIODE: - retVal = tesselateDiodeInWorld( (DiodeTile_SPU *)tt, x, y, z ); + retVal = tesselateDiodeInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_PISTON_BASE: retVal = tesselatePistonBaseInWorld( tt, x, y, z, false, forceData ); @@ -333,7 +333,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateVineInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_FENCE_GATE: - retVal = tesselateFenceGateInWorld( ( FenceGateTile_SPU* )tt, x, y, z ); + retVal = tesselateFenceGateInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_CAULDRON: retVal = tesselateCauldronInWorld((CauldronTile_SPU* ) tt, x, y, z); @@ -345,7 +345,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateAnvilInWorld((AnvilTile_SPU *) tt, x, y, z); break; case Tile_SPU::SHAPE_BREWING_STAND: - retVal = tesselateBrewingStandInWorld((BrewingStandTile_SPU* ) tt, x, y, z); + retVal = tesselateBrewingStandInWorld(static_cast(tt), x, y, z); break; case Tile_SPU::SHAPE_PORTAL_FRAME: retVal = tesselateAirPortalFrameInWorld((TheEndPortalFrameTile *)tt, x, y, z); @@ -838,7 +838,7 @@ bool TileRenderer_SPU::tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, i float xOff = 0; float yOff = 4; float zOff = 0; - Tile *plant = NULL; + Tile *plant = nullptr; switch (type) { @@ -858,7 +858,7 @@ bool TileRenderer_SPU::tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, i t->addOffset(xOff / 16.0f, yOff / 16.0f, zOff / 16.0f); - if (plant != NULL) + if (plant != nullptr) { tesselateInWorld(plant, x, y, z); } @@ -1099,23 +1099,23 @@ bool TileRenderer_SPU::tesselateTorchInWorld( Tile_SPU* tt, int x, int y, int z float h = 0.20f; if ( dir == 1 ) { - tesselateTorch( tt, (float)x - r2, (float)y + h, (float)z, -r, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x) - r2, static_cast(y) + h, static_cast(z), -r, 0.0f, 0 ); } else if ( dir == 2 ) { - tesselateTorch( tt, (float)x + r2, (float)y + h, (float)z, +r, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x) + r2, static_cast(y) + h, static_cast(z), +r, 0.0f, 0 ); } else if ( dir == 3 ) { - tesselateTorch( tt, (float)x, (float)y + h, z - r2, 0.0f, -r, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y) + h, z - r2, 0.0f, -r, 0 ); } else if ( dir == 4 ) { - tesselateTorch( tt, (float)x, (float)y + h, (float)z + r2, 0.0f, +r, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y) + h, static_cast(z) + r2, 0.0f, +r, 0 ); } else { - tesselateTorch( tt, (float)x, (float)y, (float)z, 0.0f, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y), static_cast(z), 0.0f, 0.0f, 0 ); } return true; @@ -1724,7 +1724,7 @@ bool TileRenderer_SPU::tesselateLeverInWorld( Tile_SPU* tt, int x, int y, int z } } - Vec3* c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; + Vec3* c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; for ( int i = 0; i < 6; i++ ) { if ( i == 0 ) @@ -1897,7 +1897,7 @@ bool TileRenderer_SPU::tesselateTripwireSourceInWorld(Tile_SPU *tt, int x, int y corners[i]->z += z + 0.5; } - Vec3 *c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; + Vec3 *c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; int stickX0 = 7; int stickX1 = 9; int stickY0 = 9; @@ -2321,15 +2321,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int float z0_ = z + 0.5f - 0.3f; float z1_ = z + 0.5f + 0.3f; - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 1), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 0), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 0), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 1), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(); @@ -2337,15 +2337,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int u1 = tex->getU1(); v1 = tex->getV1(); - t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); x0 = x + 0.5f - 0.5f; x1 = x + 0.5f + 0.5f; @@ -2357,15 +2357,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int z0_ = z + 0.5f - 0.4f; z1_ = z + 0.5f + 0.4f; - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 0), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 1), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 1), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 0), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u1 ), ( float )( v0 ) ); tex = firstTex; u0 = tex->getU0(); @@ -2373,15 +2373,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int u1 = tex->getU1(); v1 = tex->getV1(); - t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); } else { @@ -2425,10 +2425,10 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int { t->vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + - 0.0f ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + - 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 1 - 0), ( float )( y + 0 + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( static_cast(x + 1 - 0), ( float )( y + 0 + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); @@ -2504,14 +2504,14 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int if ( ( ( x + y + z ) & 1 ) == 0 ) { - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + - 0 ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + - 0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + - 1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + - 1 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + + 0), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + + 0), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + + 1), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + + 1), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(); @@ -2523,10 +2523,10 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int 1.0f ), ( float )( u1 ), ( float )( v0 ) ); t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + - 0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + - 0 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), static_cast(z + + 0), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + + 0), ( float )( u0 ), ( float )( v0 ) ); } else { @@ -2789,15 +2789,15 @@ bool TileRenderer_SPU::tesselateRailInWorld( RailTile_SPU* tt, int x, int y, int float r = 1 / 16.0f; - float x0 = ( float )( x + 1 ); - float x1 = ( float )( x + 1 ); - float x2 = ( float )( x + 0 ); - float x3 = ( float )( x + 0 ); + float x0 = static_cast(x + 1); + float x1 = static_cast(x + 1); + float x2 = static_cast(x + 0); + float x3 = static_cast(x + 0); - float z0 = ( float )( z + 0 ); - float z1 = ( float )( z + 1 ); - float z2 = ( float )( z + 1 ); - float z3 = ( float )( z + 0 ); + float z0 = static_cast(z + 0); + float z1 = static_cast(z + 1); + float z2 = static_cast(z + 1); + float z3 = static_cast(z + 0); float y0 = ( float )( y + r ); float y1 = ( float )( y + r ); @@ -2806,24 +2806,24 @@ bool TileRenderer_SPU::tesselateRailInWorld( RailTile_SPU* tt, int x, int y, int if ( data == 1 || data == 2 || data == 3 || data == 7 ) { - x0 = x3 = ( float )( x + 1 ); - x1 = x2 = ( float )( x + 0 ); - z0 = z1 = ( float )( z + 1 ); - z2 = z3 = ( float )( z + 0 ); + x0 = x3 = static_cast(x + 1); + x1 = x2 = static_cast(x + 0); + z0 = z1 = static_cast(z + 1); + z2 = z3 = static_cast(z + 0); } else if ( data == 8 ) { - x0 = x1 = ( float )( x + 0 ); - x2 = x3 = ( float )( x + 1 ); - z0 = z3 = ( float )( z + 1 ); - z1 = z2 = ( float )( z + 0 ); + x0 = x1 = static_cast(x + 0); + x2 = x3 = static_cast(x + 1); + z0 = z3 = static_cast(z + 1); + z1 = z2 = static_cast(z + 0); } else if ( data == 9 ) { - x0 = x3 = ( float )( x + 0 ); - x1 = x2 = ( float )( x + 1 ); - z0 = z1 = ( float )( z + 0 ); - z2 = z3 = ( float )( z + 1 ); + x0 = x3 = static_cast(x + 0); + x1 = x2 = static_cast(x + 1); + z0 = z1 = static_cast(z + 0); + z2 = z3 = static_cast(z + 1); } if ( data == 2 || data == 4 ) @@ -3555,9 +3555,9 @@ bool TileRenderer_SPU::tesselateCrossInWorld( Tile_SPU* tt, int x, int y, int z } t->color( br * r, br * g, br * b ); - float xt = (float)x; - float yt = (float)y; - float zt = (float)z; + float xt = static_cast(x); + float yt = static_cast(y); + float zt = static_cast(z); if (tt->id == Tile_SPU::tallgrass_Id) { @@ -3575,7 +3575,7 @@ bool TileRenderer_SPU::tesselateCrossInWorld( Tile_SPU* tt, int x, int y, int z bool TileRenderer_SPU::tesselateStemInWorld( Tile_SPU* _tt, int x, int y, int z ) { - StemTile_SPU* tt = ( StemTile_SPU* )_tt; + StemTile_SPU* tt = static_cast(_tt); Tesselator_SPU* t = getTesselator(); float br; @@ -3805,7 +3805,7 @@ bool TileRenderer_SPU::tesselateLilypadInWorld(WaterlilyTile_SPU *tt, int x, int int64_t seed = (x * 3129871) ^ (z * 116129781l) ^ (y); seed = seed * seed * 42317861 + seed * 11; - int dir = (int) ((seed >> 16) & 0x3); + int dir = static_cast((seed >> 16) & 0x3); @@ -4017,7 +4017,7 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z { changed = true; Icon_SPU *tex = getTexture( tt, 1, data ); - float angle = ( float )LiquidTile_SPU::getSlopeAngle( level, x, y, z, m ); + float angle = static_cast(LiquidTile_SPU::getSlopeAngle(level, x, y, z, m)); if ( angle > -999 ) { tex = getTexture( tt, 2, data ); @@ -4112,8 +4112,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z { hh0 = ( float )( h0 ); hh1 = ( float )( h3 ); - x0 = ( float )( x ); - x1 = ( float )( x + 1 ); + x0 = static_cast(x); + x1 = static_cast(x + 1); z0 = ( float )( z + offs); z1 = ( float )( z + offs); } @@ -4121,8 +4121,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z { hh0 = ( float )( h2 ); hh1 = ( float )( h1 ); - x0 = ( float )( x + 1 ); - x1 = ( float )( x ); + x0 = static_cast(x + 1); + x1 = static_cast(x); z0 = ( float )( z + 1 - offs); z1 = ( float )( z + 1 - offs); } @@ -4132,8 +4132,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z hh1 = ( float )( h0 ); x0 = ( float )( x + offs); x1 = ( float )( x + offs); - z0 = ( float )( z + 1 ); - z1 = ( float )( z ); + z0 = static_cast(z + 1); + z1 = static_cast(z); } else { @@ -4141,8 +4141,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z hh1 = ( float )( h2 ); x0 = ( float )( x + 1 - offs); x1 = ( float )( x + 1 - offs); - z0 = ( float )( z ); - z1 = ( float )( z + 1 ); + z0 = static_cast(z); + z1 = static_cast(z + 1); } @@ -4172,8 +4172,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z t->color( c11 * br * r, c11 * br * g, c11 * br * b ); t->vertexUV( ( float )( x0 ), ( float )( y + hh0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v01 ) ); t->vertexUV( ( float )( x1 ), ( float )( y + hh1 ), ( float )( z1 ), ( float )( u1 ), ( float )( v02 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); } @@ -4586,7 +4586,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti else { /*#ifdef _DEBUG - if(dynamic_cast(tt)!=NULL) + if(dynamic_cast(tt)!=nullptr) { // stair tile faceFlags |= tt->shouldRenderFace( level, pX, pY - 1, pZ, 0 ) ? 0x01 : 0; @@ -4786,7 +4786,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; - renderFaceDown( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture( tt, level, pX, pY, pZ, 0 ) ); + renderFaceDown( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture( tt, level, pX, pY, pZ, 0 ) ); } if ( faceFlags & 0x02 ) { @@ -4878,7 +4878,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= ll4; - renderFaceUp( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture( tt, level, pX, pY, pZ, 1 ) ); + renderFaceUp( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture( tt, level, pX, pY, pZ, 1 ) ); } if ( faceFlags & 0x04 ) { @@ -4946,14 +4946,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll2 = (ll00z + ll0Yz + llX0z + llXYz) / 4.0f; float _ll3 = (ll0yz + ll00z + llXyz + llX0z) / 4.0f; float _ll4 = (llxyz + llx0z + ll0yz + ll00z) / 4.0f; - ll1 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll4 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX0)); - ll2 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll2 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll4 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX1)); - ll3 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll2 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll4 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX1)); - ll4 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll4 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX0)); + ll1 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll4 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX0)); + ll2 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll2 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll4 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX1)); + ll3 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll2 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll4 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX1)); + ll4 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll4 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX0)); int _tc1 = blend(ccx0z, ccxYz, cc0Yz, cc00z); int _tc2 = blend(cc0Yz, ccX0z, ccXYz, cc00z); @@ -4998,7 +4998,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 2); - renderNorth( tt, ( float )pX, ( float )pY, ( float )pZ, tex ); + renderNorth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), tex ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { @@ -5015,7 +5015,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c3b *= pBaseBlue; c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderNorth( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderNorth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -5082,14 +5082,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll4 = (ll00Z + ll0YZ + llX0Z + llXYZ) / 4.0f; float _ll3 = (ll0yZ + ll00Z + llXyZ + llX0Z) / 4.0f; float _ll2 = (llxyZ + llx0Z + ll0yZ + ll00Z) / 4.0f; - ll1 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll4 * tileShapeY1 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll2 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX0)); - ll2 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll4 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll2 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX0)); - ll3 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll4 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll2 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX1)); - ll4 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll4 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll2 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX1)); + ll1 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll4 * tileShapeY1 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll2 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX0)); + ll2 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll4 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll2 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX0)); + ll3 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll4 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll2 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX1)); + ll4 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll4 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll2 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX1)); int _tc1 = blend(ccx0Z, ccxYZ, cc0YZ, cc00Z); int _tc4 = blend(cc0YZ, ccX0Z, ccXYZ, cc00Z); @@ -5134,7 +5134,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 3); - renderSouth( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture(tt, level, pX, pY, pZ, 3 ) ); + renderSouth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture(tt, level, pX, pY, pZ, 3 ) ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { @@ -5151,7 +5151,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c3b *= pBaseBlue; c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderSouth( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderSouth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -5217,14 +5217,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll1 = (llx00 + llx0Z + llxY0 + llxYZ) / 4.0f; float _ll2 = (llx0z + llx00 + llxYz + llxY0) / 4.0f; float _ll3 = (llxyz + llxy0 + llx0z + llx00) / 4.0f; - ll1 = (float) (_ll1 * tileShapeY1 * tileShapeZ1 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY1) - * tileShapeZ1); - ll2 = (float) (_ll1 * tileShapeY1 * tileShapeZ0 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY1) - * tileShapeZ0); - ll3 = (float) (_ll1 * tileShapeY0 * tileShapeZ0 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY0) - * tileShapeZ0); - ll4 = (float) (_ll1 * tileShapeY0 * tileShapeZ1 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY0) - * tileShapeZ1); + ll1 = static_cast(_ll1 * tileShapeY1 * tileShapeZ1 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY1) + * tileShapeZ1); + ll2 = static_cast(_ll1 * tileShapeY1 * tileShapeZ0 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY1) + * tileShapeZ0); + ll3 = static_cast(_ll1 * tileShapeY0 * tileShapeZ0 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY0) + * tileShapeZ0); + ll4 = static_cast(_ll1 * tileShapeY0 * tileShapeZ1 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY0) + * tileShapeZ1); int _tc4 = blend(ccxy0, ccxyZ, ccx0Z, ccx00); int _tc1 = blend(ccx0Z, ccxY0, ccxYZ, ccx00); @@ -5269,7 +5269,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 4); - renderWest( tt, ( float )pX, ( float )pY, ( float )pZ, tex ); + renderWest( tt, static_cast(pX), static_cast(pY), static_cast(pZ), tex ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { @@ -5286,7 +5286,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c3b *= pBaseBlue; c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderWest( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderWest( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -5352,14 +5352,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll2 = (llXyz + llXy0 + llX0z + llX00) / 4.0f; float _ll3 = (llX0z + llX00 + llXYz + llXY0) / 4.0f; float _ll4 = (llX00 + llX0Z + llXY0 + llXYZ) / 4.0f; - ll1 = (float) (_ll1 * (1.0 - tileShapeY0) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY0 - * tileShapeZ1); - ll2 = (float) (_ll1 * (1.0 - tileShapeY0) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY0 - * tileShapeZ0); - ll3 = (float) (_ll1 * (1.0 - tileShapeY1) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY1 - * tileShapeZ0); - ll4 = (float) (_ll1 * (1.0 - tileShapeY1) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY1 - * tileShapeZ1); + ll1 = static_cast(_ll1 * (1.0 - tileShapeY0) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY0 + * tileShapeZ1); + ll2 = static_cast(_ll1 * (1.0 - tileShapeY0) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY0 + * tileShapeZ0); + ll3 = static_cast(_ll1 * (1.0 - tileShapeY1) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY1 + * tileShapeZ0); + ll4 = static_cast(_ll1 * (1.0 - tileShapeY1) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY1 + * tileShapeZ1); int _tc1 = blend(ccXy0, ccXyZ, ccX0Z, ccX00); int _tc4 = blend(ccX0Z, ccXY0, ccXYZ, ccX00); @@ -5405,7 +5405,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= ll4; Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 5); - renderEast( tt, ( float )pX, ( float )pY, ( float )pZ, tex ); + renderEast( tt, static_cast(pX), static_cast(pY), static_cast(pZ), tex ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { c1r *= pBaseRed; @@ -5422,7 +5422,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderEast( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderEast( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -6005,8 +6005,8 @@ int TileRenderer_SPU::blend( int a, int b, int c, int def ) int TileRenderer_SPU::blend(int a, int b, int c, int d, float fa, float fb, float fc, float fd) { - int top = (int) ((float) ((a >> 16) & 0xff) * fa + (float) ((b >> 16) & 0xff) * fb + (float) ((c >> 16) & 0xff) * fc + (float) ((d >> 16) & 0xff) * fd) & 0xff; - int bottom = (int) ((float) (a & 0xff) * fa + (float) (b & 0xff) * fb + (float) (c & 0xff) * fc + (float) (d & 0xff) * fd) & 0xff; + int top = static_cast((float)((a >> 16) & 0xff) * fa + (float)((b >> 16) & 0xff) * fb + (float)((c >> 16) & 0xff) * fc + (float)((d >> 16) & 0xff) * fd) & 0xff; + int bottom = static_cast((float)(a & 0xff) * fa + (float)(b & 0xff) * fb + (float)(c & 0xff) * fc + (float)(d & 0xff) * fd) & 0xff; return (top << 16) | bottom; } @@ -7626,7 +7626,7 @@ Icon_SPU *TileRenderer_SPU::getTexture(Tile_SPU *tile) Icon_SPU *TileRenderer_SPU::getTextureOrMissing(Icon_SPU *Icon_SPU) { - if (Icon_SPU == NULL) + if (Icon_SPU == nullptr) { assert(0); // return minecraft->textures->getMissingIcon_SPU(Icon_SPU::TYPE_TERRAIN); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h index 2c484faa..3f34a778 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h @@ -72,8 +72,8 @@ public: void tesselateInWorldFixedTexture( Tile_SPU* tile, int x, int y, int z, Icon_SPU *fixedTexture ); // 4J renamed to differentiate from tesselateInWorld void tesselateInWorldNoCulling( Tile_SPU* tile, int x, int y, int z, int forceData = -1, - TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param - bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param + TileEntity* forceEntity = nullptr ); // 4J added forceData, forceEntity param + bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr ); // 4J added forceData, forceEntity param private: bool tesselateAirPortalFrameInWorld(TheEndPortalFrameTile *tt, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp index f2dfeaac..c5a9be4d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp @@ -92,7 +92,7 @@ #include #include "AnvilTile_SPU.h" -TileData_SPU* Tile_SPU::ms_pTileData = NULL; +TileData_SPU* Tile_SPU::ms_pTileData = nullptr; Tile_SPU Tile_SPU::m_tiles[256]; @@ -181,7 +181,7 @@ Icon_SPU *Tile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int } - Icon_SPU *icon = NULL; + Icon_SPU *icon = nullptr; if(opaque) { LeafTile_SPU::setFancy(false); @@ -215,13 +215,13 @@ Icon_SPU *Tile_SPU::getTexture(int face) // void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, Entity *source) // { // AABB *aabb = getAABB(level, x, y, z); -// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); +// if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); // } // // void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes) // { // AABB *aabb = getAABB(level, x, y, z); -// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); +// if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); // } // // AABB *Tile_SPU::getAABB(Level *level, int x, int y, int z) @@ -368,18 +368,18 @@ Icon_SPU *Tile_SPU::getTexture(int face) // Vec3 *zh0 = a->clipZ(b, zz0); // Vec3 *zh1 = a->clipZ(b, zz1); // -// Vec3 *closest = NULL; +// Vec3 *closest = nullptr; // -// if (containsX(xh0) && (closest == NULL || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0; -// if (containsX(xh1) && (closest == NULL || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1; -// if (containsY(yh0) && (closest == NULL || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0; -// if (containsY(yh1) && (closest == NULL || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1; -// if (containsZ(zh0) && (closest == NULL || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0; -// if (containsZ(zh1) && (closest == NULL || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1; +// if (containsX(xh0) && (closest == nullptr || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0; +// if (containsX(xh1) && (closest == nullptr || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1; +// if (containsY(yh0) && (closest == nullptr || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0; +// if (containsY(yh1) && (closest == nullptr || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1; +// if (containsZ(zh0) && (closest == nullptr || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0; +// if (containsZ(zh1) && (closest == nullptr || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1; // // LeaveCriticalSection(&m_csShape); // -// if (closest == NULL) return NULL; +// if (closest == nullptr) return nullptr; // // int face = -1; // @@ -395,19 +395,19 @@ Icon_SPU *Tile_SPU::getTexture(int face) // // bool Tile_SPU::containsX(Vec3 *v) // { -// if( v == NULL) return false; +// if( v == nullptr) return false; // return v->y >= yy0 && v->y <= yy1 && v->z >= zz0 && v->z <= zz1; // } // // bool Tile_SPU::containsY(Vec3 *v) // { -// if( v == NULL) return false; +// if( v == nullptr) return false; // return v->x >= xx0 && v->x <= xx1 && v->z >= zz0 && v->z <= zz1; // } // // bool Tile_SPU::containsZ(Vec3 *v) // { -// if( v == NULL) return false; +// if( v == nullptr) return false; // return v->x >= xx0 && v->x <= xx1 && v->y >= yy0 && v->y <= yy1; // } // @@ -516,7 +516,7 @@ void Tile_SPU::updateDefaultShape() // // 4J Stu - Special case - only record a crop destroy if is fully grown // if(id==Tile_SPU::crops_Id) // { -// if( Tile_SPU::crops->getResource(data, NULL, 0) > 0 ) +// if( Tile_SPU::crops->getResource(data, nullptr, 0) > 0 ) // player->awardStat(Stats::blocksMined[id], 1); // } // else @@ -533,7 +533,7 @@ void Tile_SPU::updateDefaultShape() // if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory)) // { // shared_ptr item = getSilkTouchItemInstance(data); -// if (item != NULL) +// if (item != nullptr) // { // popResource(level, x, y, z, item); // } @@ -625,7 +625,7 @@ float Tile_SPU::getShadeBrightness(ChunkRebuildData *level, int x, int y, int z) Tile_SPU* Tile_SPU::createFromID( int tileID ) { if(tileID == 0) - return NULL; + return nullptr; if(m_tiles[tileID].id != -1) return &m_tiles[tileID]; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h index 484823ef..e3d11f04 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h @@ -242,7 +242,7 @@ public: Icon_SPU *getTexture(int face, int data); Icon_SPU *getTexture(int face); public: - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param double getShapeX0(); double getShapeX1(); double getShapeY0(); @@ -465,7 +465,7 @@ public: double getShapeZ1() { return ms_pTileData->zz1[id]; } Material_SPU* getMaterial(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual void setShape(float x0, float y0, float z0, float x1, float y1, float z1); virtual float getBrightness(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h index 2b5f86a5..43cffbf8 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h @@ -14,7 +14,7 @@ public: bool blocksLight() { return false; } bool isSolidRender(bool isServerLevel = false) { return false; } bool isCubeShaped() { return false; } - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int height = level->getData(x, y, z) & HEIGHT_MASK; float o = 2 * (1 + height) / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h index 6f096a17..4f72c543 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h @@ -21,7 +21,7 @@ public: bool isSolidRender(bool isServerLevel = false) { return false; } bool isCubeShaped() { return false; } int getRenderShape() { return Tile_SPU::SHAPE_BLOCK;} - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h index e2f4a4ad..7d94e750 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h @@ -27,7 +27,7 @@ public: return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { const float thickness = 1.0f / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h index e298ae2d..7065210f 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h @@ -172,15 +172,15 @@ public: // { // public: // ZipFile(File *file) {} -// InputStream *getInputStream(ZipEntry *entry) { return NULL; } -// ZipEntry *getEntry(const wstring& name) {return NULL;} +// InputStream *getInputStream(ZipEntry *entry) { return nullptr; } +// ZipEntry *getEntry(const wstring& name) {return nullptr;} // void close() {} // }; // // class ImageIO // { // public: -// static BufferedImage *read(InputStream *in) { return NULL; } +// static BufferedImage *read(InputStream *in) { return nullptr; } // }; // // class Keyboard diff --git a/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp index dc134eca..16ea17bb 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp @@ -315,7 +315,7 @@ void TileCompressData_SPU::loadAndUncompressLowerSection(int block, int x0, int // tile IDs first // --------------------------- - if(m_lowerBlocks[block] != NULL) + if(m_lowerBlocks[block] != nullptr) { int dmaSize = padTo16(m_lowerBlocksSize[block]); DmaData_SPU::getAndWait(m_pTileStorage->getDataPtr(), (uint32_t)m_lowerBlocks[block], dmaSize); @@ -366,7 +366,7 @@ void TileCompressData_SPU::loadAndUncompressLowerSection(int block, int x0, int void TileCompressData_SPU::loadAndUncompressUpperSection(int block, int x0, int z0, int x1, int z1) { - if(m_upperBlocks[block] != NULL) + if(m_upperBlocks[block] != nullptr) { int dmaSize = padTo16(m_upperBlocksSize[block]); DmaData_SPU::getAndWait(m_pTileStorage->getDataPtr(), (uint32_t)m_upperBlocks[block], dmaSize); @@ -507,7 +507,7 @@ void TileCompressData_SPU::setForChunk( Region* region, int x0, int y0, int z0 ) } else { - m_lowerBlocks[i*3+j] = NULL; + m_lowerBlocks[i*3+j] = nullptr; m_lowerBlocksSize[i*3+j] = 0; m_lowerSkyLight[i*3+j] = 0; m_lowerBlockLight[i*3+j] = 0; @@ -527,7 +527,7 @@ void TileCompressData_SPU::setForChunk( Region* region, int x0, int y0, int z0 ) } else { - m_upperBlocks[i*3+j] = NULL; + m_upperBlocks[i*3+j] = nullptr; m_upperBlocksSize[i*3+j] = 0; m_upperSkyLight[i*3+j] = 0; m_upperBlockLight[i*3+j] = 0; -- cgit v1.2.3