aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Xbox/Sentient/SentientManager.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Xbox/Sentient/SentientManager.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* 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
Diffstat (limited to 'Minecraft.Client/Xbox/Sentient/SentientManager.cpp')
-rw-r--r--Minecraft.Client/Xbox/Sentient/SentientManager.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp
index aade06bc..49b0c26a 100644
--- a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp
+++ b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp
@@ -20,7 +20,7 @@ CTelemetryManager *TelemetryManager = new CSentientManager();
HRESULT CSentientManager::Init()
{
Sentient::SenSysTitleID sentitleID;
- sentitleID = (Sentient::SenSysTitleID)TITLEID_MINECRAFT;
+ sentitleID = static_cast<Sentient::SenSysTitleID>(TITLEID_MINECRAFT);
HRESULT hr = SentientInitialize( sentitleID );
@@ -52,7 +52,7 @@ HRESULT CSentientManager::Tick()
m_lastHeartbeat = currentTime;
for(DWORD i = 0; i < XUSER_MAX_COUNT; ++i)
{
- if(Minecraft::GetInstance()->localplayers[i] != NULL)
+ if(Minecraft::GetInstance()->localplayers[i] != nullptr)
{
SenStatHeartBeat(i, m_lastHeartbeat - m_initialiseTime);
}
@@ -63,7 +63,7 @@ HRESULT CSentientManager::Tick()
{
for(DWORD i = 0; i < XUSER_MAX_COUNT; ++i)
{
- if(Minecraft::GetInstance()->localplayers[i] != NULL && m_fLevelStartTime[i] - currentTime > 60)
+ if(Minecraft::GetInstance()->localplayers[i] != nullptr && m_fLevelStartTime[i] - currentTime > 60)
{
Flush();
}
@@ -123,7 +123,7 @@ HRESULT CSentientManager::Flush()
BOOL CSentientManager::RecordPlayerSessionStart(DWORD dwUserId)
{
- return SenStatPlayerSessionStart( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetTitleBuildId(), 0, 0, 0, (INT)app.getDeploymentType() );
+ return SenStatPlayerSessionStart( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetTitleBuildId(), 0, 0, 0, static_cast<INT>(app.getDeploymentType()) );
}
BOOL CSentientManager::RecordPlayerSessionExit(DWORD dwUserId, int _)
@@ -149,13 +149,13 @@ BOOL CSentientManager::RecordLevelStart(DWORD dwUserId, ESen_FriendOrMatch frien
BOOL CSentientManager::RecordLevelExit(DWORD dwUserId, ESen_LevelExitStatus levelExitStatus)
{
float levelDuration = app.getAppTime() - m_fLevelStartTime[dwUserId];
- return SenStatLevelExit( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), levelExitStatus, GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), (INT)levelDuration );
+ return SenStatLevelExit( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), levelExitStatus, GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), static_cast<INT>(levelDuration) );
}
BOOL CSentientManager::RecordLevelSaveOrCheckpoint(DWORD dwUserId, INT saveOrCheckPointID, INT saveSizeInBytes)
{
float levelDuration = app.getAppTime() - m_fLevelStartTime[dwUserId];
- return SenStatLevelSaveOrCheckpoint( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), (INT)levelDuration, saveOrCheckPointID, saveSizeInBytes );
+ return SenStatLevelSaveOrCheckpoint( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), static_cast<INT>(levelDuration), saveOrCheckPointID, saveSizeInBytes );
}
BOOL CSentientManager::RecordLevelResume(DWORD dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, DWORD numberOfLocalPlayers, DWORD numberOfOnlinePlayers, INT saveOrCheckPointID)
@@ -240,7 +240,7 @@ This should be tracked independently of saved games (restoring a save should not
*/
INT CSentientManager::GetSecondsSinceInitialize()
{
- return (INT)(app.getAppTime() - m_initialiseTime);
+ return static_cast<INT>(app.getAppTime() - m_initialiseTime);
}
/*
@@ -257,21 +257,21 @@ INT CSentientManager::GetMode(DWORD dwUserId)
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL )
+ if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr )
{
GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType();
if (gameType->isSurvival())
{
- mode = (INT)eTelem_ModeId_Survival;
+ mode = static_cast<INT>(eTelem_ModeId_Survival);
}
else if (gameType->isCreative())
{
- mode = (INT)eTelem_ModeId_Creative;
+ mode = static_cast<INT>(eTelem_ModeId_Creative);
}
else
{
- mode = (INT)eTelem_ModeId_Undefined;
+ mode = static_cast<INT>(eTelem_ModeId_Undefined);
}
}
return mode;
@@ -290,11 +290,11 @@ INT CSentientManager::GetSubMode(DWORD dwUserId)
if(Minecraft::GetInstance()->isTutorial())
{
- subMode = (INT)eTelem_SubModeId_Tutorial;
+ subMode = static_cast<INT>(eTelem_SubModeId_Tutorial);
}
else
{
- subMode = (INT)eTelem_SubModeId_Normal;
+ subMode = static_cast<INT>(eTelem_SubModeId_Normal);
}
return subMode;
@@ -312,7 +312,7 @@ INT CSentientManager::GetLevelId(DWORD dwUserId)
{
INT levelId = (INT)eTelem_LevelId_Undefined;
- levelId = (INT)eTelem_LevelId_PlayerGeneratedLevel;
+ levelId = static_cast<INT>(eTelem_LevelId_PlayerGeneratedLevel);
return levelId;
}
@@ -329,18 +329,18 @@ INT CSentientManager::GetSubLevelId(DWORD dwUserId)
Minecraft *pMinecraft = Minecraft::GetInstance();
- if(pMinecraft->localplayers[dwUserId] != NULL)
+ if(pMinecraft->localplayers[dwUserId] != nullptr)
{
switch(pMinecraft->localplayers[dwUserId]->dimension)
{
case 0:
- subLevelId = (INT)eTelem_SubLevelId_Overworld;
+ subLevelId = static_cast<INT>(eTelem_SubLevelId_Overworld);
break;
case -1:
- subLevelId = (INT)eTelem_SubLevelId_Nether;
+ subLevelId = static_cast<INT>(eTelem_SubLevelId_Nether);
break;
case 1:
- subLevelId = (INT)eTelem_SubLevelId_End;
+ subLevelId = static_cast<INT>(eTelem_SubLevelId_End);
break;
};
}
@@ -364,7 +364,7 @@ Helps differentiate level attempts when a play plays the same mode/level - espec
*/
INT CSentientManager::GetLevelInstanceID()
{
- return (INT)m_levelInstanceID;
+ return static_cast<INT>(m_levelInstanceID);
}
/*
@@ -403,19 +403,19 @@ INT CSentientManager::GetSingleOrMultiplayer()
if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0)
{
- singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Single_Player;
+ singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Single_Player);
}
else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0)
{
- singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Local;
+ singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Multiplayer_Local);
}
else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0)
{
- singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Live;
+ singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Multiplayer_Live);
}
else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0)
{
- singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live;
+ singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live);
}
return singleOrMultiplayer;
@@ -432,16 +432,16 @@ INT CSentientManager::GetDifficultyLevel(INT diff)
switch(diff)
{
case 0:
- difficultyLevel = (INT)eSen_DifficultyLevel_Easiest;
+ difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Easiest);
break;
case 1:
- difficultyLevel = (INT)eSen_DifficultyLevel_Easier;
+ difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Easier);
break;
case 2:
- difficultyLevel = (INT)eSen_DifficultyLevel_Normal;
+ difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Normal);
break;
case 3:
- difficultyLevel = (INT)eSen_DifficultyLevel_Harder;
+ difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Harder);
break;
}
@@ -461,11 +461,11 @@ INT CSentientManager::GetLicense()
if(ProfileManager.IsFullVersion())
{
- license = (INT)eSen_License_Full_Purchased_Title;
+ license = static_cast<INT>(eSen_License_Full_Purchased_Title);
}
else
{
- license = (INT)eSen_License_Trial_or_Demo;
+ license = static_cast<INT>(eSen_License_Trial_or_Demo);
}
return license;
}
@@ -500,15 +500,15 @@ INT CSentientManager::GetAudioSettings(DWORD dwUserId)
if(volume == 0)
{
- audioSettings = (INT)eSen_AudioSettings_Off;
+ audioSettings = static_cast<INT>(eSen_AudioSettings_Off);
}
else if(volume == DEFAULT_VOLUME_LEVEL)
{
- audioSettings = (INT)eSen_AudioSettings_On_Default;
+ audioSettings = static_cast<INT>(eSen_AudioSettings_On_Default);
}
else
{
- audioSettings = (INT)eSen_AudioSettings_On_CustomSetting;
+ audioSettings = static_cast<INT>(eSen_AudioSettings_On_CustomSetting);
}
}
return audioSettings;