Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -186,7 +186,7 @@ int PotionBrewing::getColorValue(vector<MobEffectInstance *> *effects)
int baseColor = colourTable->getColor( eMinecraftColour_Potion_BaseColour );
if (effects == nullptr || effects->empty())
if (effects == NULL || effects->empty())
{
return baseColor;
}
@@ -203,9 +203,9 @@ int PotionBrewing::getColorValue(vector<MobEffectInstance *> *effects)
for (int potency = 0; potency <= effect->getAmplifier(); potency++)
{
red += static_cast<float>((potionColor >> 16) & 0xff) / 255.0f;
green += static_cast<float>((potionColor >> 8) & 0xff) / 255.0f;
blue += static_cast<float>((potionColor >> 0) & 0xff) / 255.0f;
red += (float) ((potionColor >> 16) & 0xff) / 255.0f;
green += (float) ((potionColor >> 8) & 0xff) / 255.0f;
blue += (float) ((potionColor >> 0) & 0xff) / 255.0f;
count++;
}
}
@@ -214,7 +214,7 @@ int PotionBrewing::getColorValue(vector<MobEffectInstance *> *effects)
green = (green / count) * 255.0f;
blue = (blue / count) * 255.0f;
return static_cast<int>(red) << 16 | static_cast<int>(green) << 8 | static_cast<int>(blue);
return ((int) red) << 16 | ((int) green) << 8 | ((int) blue);
}
bool PotionBrewing::areAllEffectsAmbient(vector<MobEffectInstance *> *effects)
@@ -238,7 +238,7 @@ int PotionBrewing::getColorValue(int brew, bool includeDisabledEffects)
}
vector<MobEffectInstance *> *effects = getEffects(brew, false);
int color = getColorValue(effects);
if(effects != nullptr)
if(effects != NULL)
{
for(auto& effect : *effects)
{
@@ -325,16 +325,16 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
}
// split by and
size_t andIndex = definition.find_first_of(L'&', start);
if (andIndex != wstring::npos && andIndex < static_cast<size_t>(end))
int andIndex = (int)definition.find_first_of(L'&', start);
if (andIndex >= 0 && andIndex < end)
{
int leftSide = parseEffectFormulaValue(definition, start, static_cast<int>(andIndex) - 1, brew);
int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew);
if (leftSide <= 0)
{
return 0;
}
int rightSide = parseEffectFormulaValue(definition, static_cast<int>(andIndex) + 1, end, brew);
int rightSide = parseEffectFormulaValue(definition, andIndex + 1, end, brew);
if (rightSide <= 0)
{
return 0;
@@ -413,16 +413,16 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
}
// split by or
size_t orIndex = definition.find_first_of(L'|', start);
if (orIndex != wstring::npos && orIndex < static_cast<size_t>(end))
int orIndex = definition.find_first_of(L'|', start);
if (orIndex >= 0 && orIndex < end)
{
int leftSide = parseEffectFormulaValue(definition, start, static_cast<int>(orIndex) - 1, brew);
int leftSide = parseEffectFormulaValue(definition, start, orIndex - 1, brew);
if (leftSide > 0)
{
return leftSide;
}
int rightSide = parseEffectFormulaValue(definition, static_cast<int>(orIndex) + 1, end, brew);
int rightSide = parseEffectFormulaValue(definition, orIndex + 1, end, brew);
if (rightSide > 0)
{
return rightSide;
@@ -430,10 +430,10 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
return 0;
}
// split by and
size_t andIndex = definition.find_first_of(L'&', start);
if (andIndex != wstring::npos && andIndex < static_cast<size_t>(end))
int andIndex = definition.find_first_of(L'&', start);
if (andIndex >= 0 && andIndex < end)
{
int leftSide = parseEffectFormulaValue(definition, start, static_cast<int>(andIndex) - 1, brew);
int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew);
if (leftSide <= 0)
{
return 0;
@@ -552,13 +552,13 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
vector<MobEffectInstance *> *PotionBrewing::getEffects(int brew, bool includeDisabledEffects)
{
vector<MobEffectInstance *> *list = nullptr;
vector<MobEffectInstance *> *list = NULL;
//for (MobEffect effect : MobEffect.effects)
for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
{
MobEffect *effect = MobEffect::effects[i];
if (effect == nullptr || (effect->isDisabled() && !includeDisabledEffects))
if (effect == NULL || (effect->isDisabled() && !includeDisabledEffects))
{
continue;
}
@@ -570,7 +570,7 @@ vector<MobEffectInstance *> *PotionBrewing::getEffects(int brew, bool includeDis
}
wstring durationString = effIt->second;
int duration = parseEffectFormulaValue(durationString, 0, static_cast<int>(durationString.length()), brew);
int duration = parseEffectFormulaValue(durationString, 0, (int)durationString.length(), brew);
if (duration > 0)
{
int amplifier = 0;
@@ -578,7 +578,7 @@ vector<MobEffectInstance *> *PotionBrewing::getEffects(int brew, bool includeDis
if (ampIt != potionEffectAmplifier.end())
{
wstring amplifierString = ampIt->second;
amplifier = parseEffectFormulaValue(amplifierString, 0, static_cast<int>(amplifierString.length()), brew);
amplifier = parseEffectFormulaValue(amplifierString, 0, (int)amplifierString.length(), brew);
if (amplifier < 0)
{
amplifier = 0;
@@ -594,15 +594,15 @@ vector<MobEffectInstance *> *PotionBrewing::getEffects(int brew, bool includeDis
// 3, 8, 13, 18.. minutes
duration = (SharedConstants::TICKS_PER_SECOND * 60) * (duration * 3 + (duration - 1) * 2);
duration >>= amplifier;
duration = static_cast<int>(Math::round((double)duration * effect->getDurationModifier()));
duration = (int) Math::round((double) duration * effect->getDurationModifier());
if ((brew & THROWABLE_MASK) != 0)
{
duration = static_cast<int>(Math::round((double)duration * .75 + .5));
duration = (int) Math::round((double) duration * .75 + .5);
}
}
if (list == nullptr)
if (list == NULL)
{
list = new vector<MobEffectInstance *>();
}
@@ -756,7 +756,7 @@ int PotionBrewing::applyBrew(int currentBrew, const wstring &formula)
{
int start = 0;
int end = static_cast<int>(formula.length());
int end = (int)formula.length();
bool hasValue = false;
bool isNot = false;