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:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -23,10 +23,10 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
m_fScreenWidth=(float)pMinecraft->width_phys;
m_fRawWidth=(float)ssc.rawWidth;
m_fScreenHeight=(float)pMinecraft->height_phys;
m_fRawHeight=(float)ssc.rawHeight;
m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
m_fRawWidth=static_cast<float>(ssc.rawWidth);
m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
m_fRawHeight=static_cast<float>(ssc.rawHeight);
m_customTextureUrl = L"default";
m_backupTexture = TN_MOB_CHAR;
@@ -55,7 +55,7 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
m_fOriginalRotation = 0.0f;
m_framesAnimatingRotation = 0;
m_bAnimatingToFacing = false;
m_pvAdditionalModelParts=NULL;
m_pvAdditionalModelParts=nullptr;
m_uiAnimOverrideBitmask=0L;
}
@@ -167,7 +167,7 @@ void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAni
void UIControl_PlayerSkinPreview::CycleNextAnimation()
{
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1);
m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation + 1);
if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking;
m_swingTime = 0.0f;
@@ -175,8 +175,8 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation()
void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
{
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation - 1);
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast<ESkinPreviewAnimations>(e_SkinPreviewAnimation_Count - 1);
m_swingTime = 0.0f;
}
@@ -210,7 +210,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
Lighting::turnOn();
//glRotatef(-45 - 90, 0, 1, 0);
glRotatef(-(float)m_xRot, 1, 0, 0);
glRotatef(-static_cast<float>(m_xRot), 1, 0, 0);
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
bool wasHidingGui = pMinecraft->options->hideGui;
@@ -218,7 +218,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER);
if (renderer != NULL)
if (renderer != nullptr)
{
// 4J-PB - any additional parts to turn on for this player (skin dependent)
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
@@ -257,12 +257,12 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
glPushMatrix();
glDisable(GL_CULL_FACE);
HumanoidModel *model = (HumanoidModel *)renderer->getModel();
HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel());
//getAttackAnim(mob, a);
//if (armor != NULL) armor->attackTime = model->attackTime;
//if (armor != nullptr) armor->attackTime = model->attackTime;
//model->riding = mob->isRiding();
//if (armor != NULL) armor->riding = model->riding;
//if (armor != nullptr) armor->riding = model->riding;
// 4J Stu - Remember to reset these values once the rendering is done if you add another one
model->attackTime = 0;
@@ -292,7 +292,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
{
m_swingTime = 0;
}
model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3);
model->attackTime = m_swingTime / static_cast<float>(Player::SWING_DURATION * 3);
break;
default:
break;
@@ -306,7 +306,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
//setupPosition(mob, x, y, z);
// is equivalent to
glTranslatef((float) x, (float) y, (float) z);
glTranslatef(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
//float bob = getBob(mob, a);
#ifdef SKIN_PREVIEW_BOB_ANIM
@@ -383,11 +383,11 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
double xa = sin(yr * PI / 180);
double za = -cos(yr * PI / 180);
float flap = (float) yd * 10;
float flap = static_cast<float>(yd) * 10;
if (flap < -6) flap = -6;
if (flap > 32) flap = 32;
float lean = (float) (xd * xa + zd * za) * 100;
float lean2 = (float) (xd * za - zd * xa) * 100;
float lean = static_cast<float>(xd * xa + zd * za) * 100;
float lean2 = static_cast<float>(xd * za - zd * xa) * 100;
if (lean < 0) lean = 0;
//float pow = 1;//mob->oBob + (bob - mob->oBob) * a;