Fixed Xbox 360 crash
This commit is contained in:
@@ -105,8 +105,6 @@ GameRenderer::GameRenderer(Minecraft *mc)
|
||||
zoom = 1;
|
||||
zoom_x = 0;
|
||||
zoom_y = 0;
|
||||
rainXa = NULL;
|
||||
rainZa = NULL;
|
||||
lastActiveTime = Minecraft::currentTimeMillis();
|
||||
lastNsTime = 0;
|
||||
random = new Random();
|
||||
@@ -181,8 +179,9 @@ GameRenderer::GameRenderer(Minecraft *mc)
|
||||
// 4J Stu Added to go with 1.8.2 change
|
||||
GameRenderer::~GameRenderer()
|
||||
{
|
||||
if(rainXa != NULL) delete [] rainXa;
|
||||
if(rainZa != NULL) delete [] rainZa;
|
||||
delete random;
|
||||
delete cameraPos;
|
||||
delete lb;
|
||||
}
|
||||
|
||||
void GameRenderer::tick(bool first) // 4J - add bFirst
|
||||
@@ -838,19 +837,21 @@ void GameRenderer::updateLightTexture(float a)
|
||||
Level *level = player->level; // 4J - was mc->level when it was just to update the one light texture
|
||||
|
||||
float skyDarken1 = level->getSkyDarken((float) 1);
|
||||
float darken = skyDarken1 * 0.95f + 0.05f;
|
||||
float rsGsMul = skyDarken1 * 0.65f + 0.35f;
|
||||
float blockMul = blr * 0.1f + 1.5f;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
float darken = skyDarken1 * 0.95f + 0.05f;
|
||||
float sky = level->dimension->brightnessRamp[i / 16] * darken;
|
||||
float block = level->dimension->brightnessRamp[i % 16] * (blr * 0.1f + 1.5f);
|
||||
float block = level->dimension->brightnessRamp[i % 16] * blockMul;
|
||||
|
||||
if (level->skyFlashTime > 0)
|
||||
{
|
||||
sky = level->dimension->brightnessRamp[i / 16];
|
||||
}
|
||||
|
||||
float rs = sky * (skyDarken1 * 0.65f + 0.35f);
|
||||
float gs = sky * (skyDarken1 * 0.65f + 0.35f);
|
||||
float rs = sky * rsGsMul;
|
||||
float gs = sky * rsGsMul;
|
||||
float bs = sky;
|
||||
|
||||
float rb = block;
|
||||
@@ -1526,27 +1527,30 @@ void GameRenderer::tickRain()
|
||||
int x = x0 + random->nextInt(r) - random->nextInt(r);
|
||||
int z = z0 + random->nextInt(r) - random->nextInt(r);
|
||||
int y = level->getTopRainBlock(x, z);
|
||||
int t = level->getTile(x, y - 1, z);
|
||||
Biome *biome = level->getBiome(x,z);
|
||||
if (y <= y0 + r && y >= y0 - r && biome->hasRain() && biome->getTemperature() >= 0.2f)
|
||||
if (y <= y0 + r && y >= y0 - r)
|
||||
{
|
||||
float xa = random->nextFloat();
|
||||
float za = random->nextFloat();
|
||||
if (t > 0)
|
||||
int t = level->getTile(x, y - 1, z);
|
||||
Biome *biome = level->getBiome(x,z);
|
||||
if (biome->hasRain() && biome->getTemperature() >= 0.2f)
|
||||
{
|
||||
if (Tile::tiles[t]->material == Material::lava)
|
||||
float xa = random->nextFloat();
|
||||
float za = random->nextFloat();
|
||||
if (t > 0)
|
||||
{
|
||||
mc->particleEngine->add( shared_ptr<SmokeParticle>( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (random->nextInt(++rainPosSamples) == 0)
|
||||
if (Tile::tiles[t]->material == Material::lava)
|
||||
{
|
||||
rainPosX = x + xa;
|
||||
rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0();
|
||||
rainPosZ = z + za;
|
||||
mc->particleEngine->add( shared_ptr<SmokeParticle>( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (random->nextInt(++rainPosSamples) == 0)
|
||||
{
|
||||
rainPosX = x + xa;
|
||||
rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0();
|
||||
rainPosZ = z + za;
|
||||
}
|
||||
mc->particleEngine->add( shared_ptr<WaterDropParticle>( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) );
|
||||
}
|
||||
mc->particleEngine->add( shared_ptr<WaterDropParticle>( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1581,10 +1585,12 @@ void GameRenderer::renderSnowAndRain(float a)
|
||||
|
||||
turnOnLightLayer(a);
|
||||
|
||||
if (rainXa == NULL)
|
||||
static float rainXa[32 * 32];
|
||||
static float rainZa[32 * 32];
|
||||
static bool rainArraysInitialized = false;
|
||||
if (!rainArraysInitialized)
|
||||
{
|
||||
rainXa = new float[32 * 32];
|
||||
rainZa = new float[32 * 32];
|
||||
rainArraysInitialized = true;
|
||||
|
||||
for (int z = 0; z < 32; z++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user