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:
@@ -28,7 +28,6 @@
|
||||
#include "..\Minecraft.World\net.minecraft.world.h"
|
||||
#include "..\Minecraft.World\LevelChunk.h"
|
||||
#include "..\Minecraft.World\Biome.h"
|
||||
#include <Common/UI/UI.h>
|
||||
|
||||
ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR);
|
||||
|
||||
@@ -88,7 +87,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
int quickSelectHeight=22;
|
||||
float fScaleFactorWidth=1.0f,fScaleFactorHeight=1.0f;
|
||||
bool bTwoPlayerSplitscreen=false;
|
||||
currentGuiScaleFactor = static_cast<float>(guiScale); // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport
|
||||
currentGuiScaleFactor = (float) guiScale; // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport
|
||||
|
||||
switch(guiScale)
|
||||
{
|
||||
@@ -118,7 +117,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
iSafezoneYHalf = splitYOffset;
|
||||
iSafezoneTopYHalf = screenHeight/10;
|
||||
fScaleFactorWidth=0.5f;
|
||||
iWidthOffset=static_cast<int>((float)screenWidth * (1.0f - fScaleFactorWidth));
|
||||
iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth));
|
||||
iTooltipsYOffset=44;
|
||||
bTwoPlayerSplitscreen=true;
|
||||
currentGuiScaleFactor *= 0.5f;
|
||||
@@ -128,7 +127,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
iSafezoneYHalf = splitYOffset + screenHeight/10;// 5% (need to treat the whole screen is 2x this screen)
|
||||
iSafezoneTopYHalf = 0;
|
||||
fScaleFactorWidth=0.5f;
|
||||
iWidthOffset=static_cast<int>((float)screenWidth * (1.0f - fScaleFactorWidth));
|
||||
iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth));
|
||||
iTooltipsYOffset=44;
|
||||
bTwoPlayerSplitscreen=true;
|
||||
currentGuiScaleFactor *= 0.5f;
|
||||
@@ -698,7 +697,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
#endif
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(static_cast<float>(xo), static_cast<float>(yo), 50);
|
||||
glTranslatef((float)xo, (float)yo, 50);
|
||||
float ss = 12;
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
@@ -807,14 +806,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
int timer = minecraft->player->getSleepTimer();
|
||||
float amount = static_cast<float>(timer) / static_cast<float>(Player::SLEEP_DURATION);
|
||||
float amount = (float) timer / (float) Player::SLEEP_DURATION;
|
||||
if (amount > 1)
|
||||
{
|
||||
// waking up
|
||||
amount = 1.0f - (static_cast<float>(timer - Player::SLEEP_DURATION) / static_cast<float>(Player::WAKE_UP_DURATION));
|
||||
amount = 1.0f - ((float) (timer - Player::SLEEP_DURATION) / (float) Player::WAKE_UP_DURATION);
|
||||
}
|
||||
|
||||
int color = static_cast<int>(220.0f * amount) << 24 | (0x101020);
|
||||
int color = (int) (220.0f * amount) << 24 | (0x101020);
|
||||
fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -826,9 +825,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
int timer = minecraft->player->getDeathFadeTimer();
|
||||
float amount = static_cast<float>(timer) / static_cast<float>(Player::DEATHFADE_DURATION);
|
||||
float amount = (float) timer / (float) Player::DEATHFADE_DURATION;
|
||||
|
||||
int color = static_cast<int>(220.0f * amount) << 24 | (0x200000);
|
||||
int color = (int) (220.0f * amount) << 24 | (0x200000);
|
||||
fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -851,15 +850,15 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
const int debugTop = 1;
|
||||
const float maxContentWidth = 1200.f;
|
||||
const float maxContentHeight = 420.f;
|
||||
float scale = static_cast<float>(screenWidth - debugLeft - 8) / maxContentWidth;
|
||||
float scaleV = static_cast<float>(screenHeight - debugTop - 80) / maxContentHeight;
|
||||
float scale = (float)(screenWidth - debugLeft - 8) / maxContentWidth;
|
||||
float scaleV = (float)(screenHeight - debugTop - 80) / maxContentHeight;
|
||||
if (scaleV < scale) scale = scaleV;
|
||||
if (scale > 1.f) scale = 1.f;
|
||||
if (scale < 0.5f) scale = 0.5f;
|
||||
glPushMatrix();
|
||||
glTranslatef(static_cast<float>(debugLeft), static_cast<float>(debugTop), 0.f);
|
||||
glTranslatef((float)debugLeft, (float)debugTop, 0.f);
|
||||
glScalef(scale, scale, 1.f);
|
||||
glTranslatef(static_cast<float>(-debugLeft), static_cast<float>(-debugTop), 0.f);
|
||||
glTranslatef((float)-debugLeft, (float)-debugTop, 0.f);
|
||||
|
||||
vector<wstring> lines;
|
||||
|
||||
@@ -985,11 +984,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
wfeature[eTerrainFeature_Village] = L"Village: ";
|
||||
wfeature[eTerrainFeature_Ravine] = L"Ravine: ";
|
||||
|
||||
float maxW = static_cast<float>(screenWidth - debugLeft - 8) / scale;
|
||||
float maxWForContent = maxW - static_cast<float>(font->width(L"..."));
|
||||
float maxW = (float)(screenWidth - debugLeft - 8) / scale;
|
||||
float maxWForContent = maxW - (float)font->width(L"...");
|
||||
bool truncated[eTerrainFeature_Count] = {};
|
||||
|
||||
for (size_t i = 0; i < app.m_vTerrainFeatures.size(); i++)
|
||||
for (int i = 0; i < (int)app.m_vTerrainFeatures.size(); i++)
|
||||
{
|
||||
FEATURE_DATA *pFeatureData = app.m_vTerrainFeatures[i];
|
||||
int type = pFeatureData->eTerrainFeature;
|
||||
@@ -1015,7 +1014,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
}
|
||||
|
||||
lines.push_back(L""); // Add a spacer line
|
||||
for (int i = eTerrainFeature_Stronghold; i <= static_cast<int>(eTerrainFeature_Ravine); i++)
|
||||
for (int i = eTerrainFeature_Stronghold; i <= (int)eTerrainFeature_Ravine; i++)
|
||||
{
|
||||
lines.push_back(wfeature[i]);
|
||||
}
|
||||
@@ -1242,10 +1241,10 @@ void Gui::renderPumpkin(int w, int h)
|
||||
MemSect(0);
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
t->vertexUV(static_cast<float>(0), static_cast<float>(h), static_cast<float>(-90), static_cast<float>(0), static_cast<float>(1));
|
||||
t->vertexUV(static_cast<float>(w), static_cast<float>(h), static_cast<float>(-90), static_cast<float>(1), static_cast<float>(1));
|
||||
t->vertexUV(static_cast<float>(w), static_cast<float>(0), static_cast<float>(-90), static_cast<float>(1), static_cast<float>(0));
|
||||
t->vertexUV(static_cast<float>(0), static_cast<float>(0), static_cast<float>(-90), static_cast<float>(0), static_cast<float>(0));
|
||||
t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( 0), (float)( 1));
|
||||
t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( 1), (float)( 1));
|
||||
t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( 1), (float)( 0));
|
||||
t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( 0), (float)( 0));
|
||||
t->end();
|
||||
glDepthMask(true);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -1306,10 +1305,10 @@ void Gui::renderTp(float br, int w, int h)
|
||||
float v1 = slot->getV1();
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
t->vertexUV(static_cast<float>(0), static_cast<float>(h), static_cast<float>(-90), (float)( u0), (float)( v1));
|
||||
t->vertexUV(static_cast<float>(w), static_cast<float>(h), static_cast<float>(-90), (float)( u1), (float)( v1));
|
||||
t->vertexUV(static_cast<float>(w), static_cast<float>(0), static_cast<float>(-90), (float)( u1), (float)( v0));
|
||||
t->vertexUV(static_cast<float>(0), static_cast<float>(0), static_cast<float>(-90), (float)( u0), (float)( v0));
|
||||
t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( u0), (float)( v1));
|
||||
t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( u1), (float)( v1));
|
||||
t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( u1), (float)( v0));
|
||||
t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( u0), (float)( v0));
|
||||
t->end();
|
||||
glDepthMask(true);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -1327,10 +1326,10 @@ void Gui::renderSlot(int slot, int x, int y, float a)
|
||||
if (pop > 0)
|
||||
{
|
||||
glPushMatrix();
|
||||
float squeeze = 1 + pop / static_cast<float>(Inventory::POP_TIME_DURATION);
|
||||
glTranslatef(static_cast<float>(x + 8), static_cast<float>(y + 12), 0);
|
||||
float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION;
|
||||
glTranslatef((float)(x + 8), (float)(y + 12), 0);
|
||||
glScalef(1 / squeeze, (squeeze + 1) / 2, 1);
|
||||
glTranslatef(static_cast<float>(-(x + 8)), static_cast<float>(-(y + 12)), 0);
|
||||
glTranslatef((float)-(x + 8), (float)-(y + 12), 0);
|
||||
}
|
||||
|
||||
itemRenderer->renderAndDecorateItem(minecraft->font, minecraft->textures, item, x, y);
|
||||
@@ -1469,7 +1468,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
size_t iLast=string.find_last_of(L" ",i);
|
||||
int iLast=(int)string.find_last_of(L" ",i);
|
||||
switch(XGetLanguage())
|
||||
{
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
@@ -1478,7 +1477,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage)
|
||||
iLast = maximumChars;
|
||||
break;
|
||||
default:
|
||||
iLast=string.find_last_of(L" ",i);
|
||||
iLast=(int)string.find_last_of(L" ",i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1538,7 +1537,7 @@ float Gui::getOpacity(int iPad, DWORD index)
|
||||
float Gui::getJukeboxOpacity(int iPad)
|
||||
{
|
||||
float t = overlayMessageTime - lastTickA;
|
||||
int alpha = static_cast<int>(t * 256 / 20);
|
||||
int alpha = (int) (t * 256 / 20);
|
||||
if (alpha > 255) alpha = 255;
|
||||
alpha /= 255;
|
||||
|
||||
@@ -1572,7 +1571,7 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, static_cast<float>(minecraft->width), static_cast<float>(height), 0, 1000, 3000);
|
||||
glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
@@ -1603,8 +1602,8 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc
|
||||
|
||||
int64_t aVal = dataA[i] / dataAScale;
|
||||
|
||||
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0));
|
||||
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0));
|
||||
}
|
||||
|
||||
if( dataB != NULL )
|
||||
@@ -1620,8 +1619,8 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc
|
||||
|
||||
int64_t bVal = dataB[i] / dataBScale;
|
||||
|
||||
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), (float)( 0));
|
||||
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), (float)( 0));
|
||||
}
|
||||
}
|
||||
t->end();
|
||||
@@ -1636,7 +1635,7 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, static_cast<float>(minecraft->width), static_cast<float>(height), 0, 1000, 3000);
|
||||
glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
@@ -1665,15 +1664,15 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64
|
||||
|
||||
if( thisVal > 0 )
|
||||
{
|
||||
float vary = static_cast<float>(source)/dataSources;
|
||||
float vary = (float)source/dataSources;
|
||||
int fColour = floor(vary * 0xffffff);
|
||||
|
||||
int colour = 0xff000000 + fColour;
|
||||
//printf("Colour is %x\n", colour);
|
||||
t->color(colour);
|
||||
|
||||
t->vertex((float)(i + 0.5f), (float)( height - topVal - thisVal + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(i + 0.5f), (float)( height - topVal - thisVal + 0.5f), (float)( 0));
|
||||
t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), (float)( 0));
|
||||
|
||||
topVal += thisVal;
|
||||
}
|
||||
@@ -1684,8 +1683,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64
|
||||
{
|
||||
t->color(0xff000000);
|
||||
|
||||
t->vertex((float)(0 + 0.5f), (float)( height - (horiz*100) + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(dataLength + 0.5f), (float)( height - (horiz*100) + 0.5f), static_cast<float>(0));
|
||||
t->vertex((float)(0 + 0.5f), (float)( height - (horiz*100) + 0.5f), (float)( 0));
|
||||
t->vertex((float)(dataLength + 0.5f), (float)( height - (horiz*100) + 0.5f), (float)( 0));
|
||||
}
|
||||
}
|
||||
t->end();
|
||||
|
||||
Reference in New Issue
Block a user