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
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.monster.h"
|
||||
#include "IUIScene_HUD.h"
|
||||
|
||||
#include "UI.h"
|
||||
|
||||
IUIScene_HUD::IUIScene_HUD()
|
||||
{
|
||||
m_lastActiveSlot = -1;
|
||||
@@ -79,7 +81,7 @@ void IUIScene_HUD::updateFrameTick()
|
||||
{
|
||||
//SetRidingHorse(false, 0);
|
||||
shared_ptr<Entity> riding = pMinecraft->localplayers[iPad]->riding;
|
||||
if(riding == NULL)
|
||||
if(riding == nullptr)
|
||||
{
|
||||
SetRidingHorse(false, false, 0);
|
||||
}
|
||||
@@ -146,8 +148,8 @@ void IUIScene_HUD::updateFrameTick()
|
||||
{
|
||||
if(uiOpacityTimer<10)
|
||||
{
|
||||
float fStep=(80.0f-(float)ucAlpha)/10.0f;
|
||||
fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
|
||||
float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
|
||||
fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -156,7 +158,7 @@ void IUIScene_HUD::updateFrameTick()
|
||||
}
|
||||
else
|
||||
{
|
||||
fVal=0.01f*(float)ucAlpha;
|
||||
fVal=0.01f*static_cast<float>(ucAlpha);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -166,12 +168,12 @@ void IUIScene_HUD::updateFrameTick()
|
||||
{
|
||||
ucAlpha=15;
|
||||
}
|
||||
fVal=0.01f*(float)ucAlpha;
|
||||
fVal=0.01f*static_cast<float>(ucAlpha);
|
||||
}
|
||||
SetOpacity(fVal);
|
||||
|
||||
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(iPad) && !(app.GetXuiAction(iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(iPad,eGameSetting_DisplayHUD)!=0;
|
||||
if(bDisplayGui && pMinecraft->localplayers[iPad] != NULL)
|
||||
if(bDisplayGui && pMinecraft->localplayers[iPad] != nullptr)
|
||||
{
|
||||
SetVisible(true);
|
||||
}
|
||||
@@ -198,7 +200,7 @@ void IUIScene_HUD::renderPlayerHealth()
|
||||
bool bHasPoison = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::poison);
|
||||
bool bHasWither = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::wither);
|
||||
AttributeInstance *maxHealthAttribute = pMinecraft->localplayers[iPad]->getAttribute(SharedMonsterAttributes::MAX_HEALTH);
|
||||
float maxHealth = (float)maxHealthAttribute->getValue();
|
||||
float maxHealth = static_cast<float>(maxHealthAttribute->getValue());
|
||||
float totalAbsorption = pMinecraft->localplayers[iPad]->getAbsorptionAmount();
|
||||
|
||||
// Update armour
|
||||
@@ -219,7 +221,7 @@ void IUIScene_HUD::renderPlayerHealth()
|
||||
|
||||
shared_ptr<Entity> riding = pMinecraft->localplayers[iPad]->riding;
|
||||
|
||||
if(riding == NULL || riding && !riding->instanceof(eTYPE_LIVINGENTITY))
|
||||
if(riding == nullptr || riding && !riding->instanceof(eTYPE_LIVINGENTITY))
|
||||
{
|
||||
SetRidingHorse(false, false, 0);
|
||||
|
||||
@@ -242,8 +244,8 @@ void IUIScene_HUD::renderPlayerHealth()
|
||||
if (pMinecraft->localplayers[iPad]->isUnderLiquid(Material::water))
|
||||
{
|
||||
ShowAir(true);
|
||||
int count = (int) ceil((pMinecraft->localplayers[iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY);
|
||||
int extra = (int) ceil((pMinecraft->localplayers[iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count;
|
||||
int count = static_cast<int>(ceil((pMinecraft->localplayers[iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY));
|
||||
int extra = static_cast<int>(ceil((pMinecraft->localplayers[iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY)) - count;
|
||||
SetAir(count, extra);
|
||||
}
|
||||
else
|
||||
@@ -254,7 +256,7 @@ void IUIScene_HUD::renderPlayerHealth()
|
||||
else if(riding->instanceof(eTYPE_LIVINGENTITY) )
|
||||
{
|
||||
shared_ptr<LivingEntity> living = dynamic_pointer_cast<LivingEntity>(riding);
|
||||
int riderCurrentHealth = (int) ceil(living->getHealth());
|
||||
int riderCurrentHealth = static_cast<int>(ceil(living->getHealth()));
|
||||
float maxRiderHealth = living->getMaxHealth();
|
||||
|
||||
SetRidingHorse(true, pMinecraft->localplayers[iPad]->isRidingJumpable(), maxRiderHealth);
|
||||
|
||||
Reference in New Issue
Block a user