shared_ptr -> std::shared_ptr

This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -3,7 +3,7 @@
#ifndef SN_TARGET_PS3_SPU
// #include "..\..\..\stdafx.h"
#endif
#endif
#endif
#include "ChunkRebuildData.h"
#include "Tesselator_SPU.h"
@@ -13,7 +13,7 @@
#include "..\..\..\..\Minecraft.World\Tile.h"
#include "..\..\..\..\Minecraft.World\Level.h"
#include "..\..\..\..\Minecraft.World\Dimension.h"
//
//
// #include "..\..\..\Chunk.h"
// #include "..\..\..\TileRenderer.h"
// #include "..\..\..\TileEntityRenderDispatcher.h"
@@ -26,13 +26,13 @@
#include "..\..\..\..\Minecraft.World\BiomeSource.h"
#else
#include "..\Common\spu_assert.h"
#endif //SN_TARGET_PS3_SPU
static const int Level_maxBuildHeight = 256;
static const int Level_MAX_LEVEL_SIZE = 30000000;
static const int Level_MAX_LEVEL_SIZE = 30000000;
static const int Level_MAX_BRIGHTNESS = 15;
@@ -53,7 +53,7 @@ int ChunkRebuildData::getGrassColor( int x, int z ) { return m_grassColor[get
int ChunkRebuildData::getFoliageColor( int x, int z ) { return m_foliageColor[getTileIdx(x,z)]; }
int ChunkRebuildData::getFlags(int x, int y, int z) { return m_data_flags[getTileIdx(x,y,z)] >> 4; }
void ChunkRebuildData::setFlag(int x, int y, int z, int flag) { m_data_flags[getTileIdx(x,y,z)] |= (flag<<4);}
#endif
#endif
@@ -77,7 +77,7 @@ void ChunkRebuildData::disableUnseenTiles()
int tileID = getTile(iX,iY,iZ);
if( tileID == 0 ) continue;
m_flags &= ~e_flag_EmptyChunk;
// Don't bother trying to work out neighbours for this tile if we are at the edge of the chunk - apart from the very
// bottom of the world where we shouldn't ever be able to see
@@ -120,7 +120,7 @@ void ChunkRebuildData::disableUnseenTiles()
}
}
}
#ifndef SN_TARGET_PS3_SPU
void setIconSPUFromIcon(Icon_SPU* iconSpu, Icon* icon)
@@ -145,78 +145,78 @@ void ChunkRebuildData::buildMaterial(int matSPUIndex, Material* mat)
void ChunkRebuildData::buildMaterials()
{
buildMaterial(Material_SPU::air_Id, Material::air);
buildMaterial(Material_SPU::grass_Id, Material::grass);
buildMaterial(Material_SPU::dirt_Id, Material::dirt);
buildMaterial(Material_SPU::wood_Id, Material::wood);
buildMaterial(Material_SPU::stone_Id, Material::stone);
buildMaterial(Material_SPU::metal_Id, Material::metal);
buildMaterial(Material_SPU::water_Id, Material::water);
buildMaterial(Material_SPU::lava_Id, Material::lava);
buildMaterial(Material_SPU::leaves_Id, Material::leaves);
buildMaterial(Material_SPU::plant_Id, Material::plant);
buildMaterial(Material_SPU::replaceable_plant_Id, Material::replaceable_plant);
buildMaterial(Material_SPU::sponge_Id, Material::sponge);
buildMaterial(Material_SPU::cloth_Id, Material::cloth);
buildMaterial(Material_SPU::fire_Id, Material::fire);
buildMaterial(Material_SPU::sand_Id, Material::sand);
buildMaterial(Material_SPU::decoration_Id, Material::decoration);
buildMaterial(Material_SPU::clothDecoration_Id, Material::clothDecoration);
buildMaterial(Material_SPU::glass_Id, Material::glass);
buildMaterial(Material_SPU::explosive_Id, Material::explosive);
buildMaterial(Material_SPU::coral_Id, Material::coral);
buildMaterial(Material_SPU::ice_Id, Material::ice);
buildMaterial(Material_SPU::topSnow_Id, Material::topSnow);
buildMaterial(Material_SPU::snow_Id, Material::snow);
buildMaterial(Material_SPU::cactus_Id, Material::cactus);
buildMaterial(Material_SPU::clay_Id, Material::clay);
buildMaterial(Material_SPU::vegetable_Id, Material::vegetable);
buildMaterial(Material_SPU::egg_Id, Material::egg);
buildMaterial(Material_SPU::portal_Id, Material::portal);
buildMaterial(Material_SPU::cake_Id, Material::cake);
buildMaterial(Material_SPU::web_Id, Material::web);
buildMaterial(Material_SPU::piston_Id, Material::piston);
buildMaterial(Material_SPU::buildable_glass_Id, Material::buildable_glass);
buildMaterial(Material_SPU::heavyMetal_Id, Material::heavyMetal);
buildMaterial(Material_SPU::air_Id, Material::air);
buildMaterial(Material_SPU::grass_Id, Material::grass);
buildMaterial(Material_SPU::dirt_Id, Material::dirt);
buildMaterial(Material_SPU::wood_Id, Material::wood);
buildMaterial(Material_SPU::stone_Id, Material::stone);
buildMaterial(Material_SPU::metal_Id, Material::metal);
buildMaterial(Material_SPU::water_Id, Material::water);
buildMaterial(Material_SPU::lava_Id, Material::lava);
buildMaterial(Material_SPU::leaves_Id, Material::leaves);
buildMaterial(Material_SPU::plant_Id, Material::plant);
buildMaterial(Material_SPU::replaceable_plant_Id, Material::replaceable_plant);
buildMaterial(Material_SPU::sponge_Id, Material::sponge);
buildMaterial(Material_SPU::cloth_Id, Material::cloth);
buildMaterial(Material_SPU::fire_Id, Material::fire);
buildMaterial(Material_SPU::sand_Id, Material::sand);
buildMaterial(Material_SPU::decoration_Id, Material::decoration);
buildMaterial(Material_SPU::clothDecoration_Id, Material::clothDecoration);
buildMaterial(Material_SPU::glass_Id, Material::glass);
buildMaterial(Material_SPU::explosive_Id, Material::explosive);
buildMaterial(Material_SPU::coral_Id, Material::coral);
buildMaterial(Material_SPU::ice_Id, Material::ice);
buildMaterial(Material_SPU::topSnow_Id, Material::topSnow);
buildMaterial(Material_SPU::snow_Id, Material::snow);
buildMaterial(Material_SPU::cactus_Id, Material::cactus);
buildMaterial(Material_SPU::clay_Id, Material::clay);
buildMaterial(Material_SPU::vegetable_Id, Material::vegetable);
buildMaterial(Material_SPU::egg_Id, Material::egg);
buildMaterial(Material_SPU::portal_Id, Material::portal);
buildMaterial(Material_SPU::cake_Id, Material::cake);
buildMaterial(Material_SPU::web_Id, Material::web);
buildMaterial(Material_SPU::piston_Id, Material::piston);
buildMaterial(Material_SPU::buildable_glass_Id, Material::buildable_glass);
buildMaterial(Material_SPU::heavyMetal_Id, Material::heavyMetal);
}
int ChunkRebuildData::getMaterialID(Tile* pTile)
{
Material* m = pTile->material;
if(m == Material::air) return Material_SPU::air_Id;
if(m == Material::grass) return Material_SPU::grass_Id;
if(m == Material::dirt) return Material_SPU::dirt_Id;
if(m == Material::wood) return Material_SPU::wood_Id;
if(m == Material::stone) return Material_SPU::stone_Id;
if(m == Material::metal) return Material_SPU::metal_Id;
if(m == Material::water) return Material_SPU::water_Id;
if(m == Material::lava) return Material_SPU::lava_Id;
if(m == Material::leaves) return Material_SPU::leaves_Id;
if(m == Material::plant) return Material_SPU::plant_Id;
if(m == Material::replaceable_plant)return Material_SPU::replaceable_plant_Id;
if(m == Material::sponge) return Material_SPU::sponge_Id;
if(m == Material::cloth) return Material_SPU::cloth_Id;
if(m == Material::fire) return Material_SPU::fire_Id;
if(m == Material::sand) return Material_SPU::sand_Id;
if(m == Material::decoration) return Material_SPU::decoration_Id;
if(m == Material::clothDecoration) return Material_SPU::clothDecoration_Id;
if(m == Material::air) return Material_SPU::air_Id;
if(m == Material::grass) return Material_SPU::grass_Id;
if(m == Material::dirt) return Material_SPU::dirt_Id;
if(m == Material::wood) return Material_SPU::wood_Id;
if(m == Material::stone) return Material_SPU::stone_Id;
if(m == Material::metal) return Material_SPU::metal_Id;
if(m == Material::water) return Material_SPU::water_Id;
if(m == Material::lava) return Material_SPU::lava_Id;
if(m == Material::leaves) return Material_SPU::leaves_Id;
if(m == Material::plant) return Material_SPU::plant_Id;
if(m == Material::replaceable_plant)return Material_SPU::replaceable_plant_Id;
if(m == Material::sponge) return Material_SPU::sponge_Id;
if(m == Material::cloth) return Material_SPU::cloth_Id;
if(m == Material::fire) return Material_SPU::fire_Id;
if(m == Material::sand) return Material_SPU::sand_Id;
if(m == Material::decoration) return Material_SPU::decoration_Id;
if(m == Material::clothDecoration) return Material_SPU::clothDecoration_Id;
if(m == Material::glass) return Material_SPU::glass_Id;
if(m == Material::explosive) return Material_SPU::explosive_Id;
if(m == Material::coral) return Material_SPU::coral_Id;
if(m == Material::ice) return Material_SPU::ice_Id;
if(m == Material::topSnow) return Material_SPU::topSnow_Id;
if(m == Material::snow) return Material_SPU::snow_Id;
if(m == Material::cactus) return Material_SPU::cactus_Id;
if(m == Material::clay) return Material_SPU::clay_Id;
if(m == Material::vegetable) return Material_SPU::vegetable_Id;
if(m == Material::egg) return Material_SPU::egg_Id;
if(m == Material::portal) return Material_SPU::portal_Id;
if(m == Material::cake) return Material_SPU::cake_Id;
if(m == Material::web) return Material_SPU::web_Id;
if(m == Material::piston) return Material_SPU::piston_Id;
if(m == Material::explosive) return Material_SPU::explosive_Id;
if(m == Material::coral) return Material_SPU::coral_Id;
if(m == Material::ice) return Material_SPU::ice_Id;
if(m == Material::topSnow) return Material_SPU::topSnow_Id;
if(m == Material::snow) return Material_SPU::snow_Id;
if(m == Material::cactus) return Material_SPU::cactus_Id;
if(m == Material::clay) return Material_SPU::clay_Id;
if(m == Material::vegetable) return Material_SPU::vegetable_Id;
if(m == Material::egg) return Material_SPU::egg_Id;
if(m == Material::portal) return Material_SPU::portal_Id;
if(m == Material::cake) return Material_SPU::cake_Id;
if(m == Material::web) return Material_SPU::web_Id;
if(m == Material::piston) return Material_SPU::piston_Id;
if(m == Material::buildable_glass) return Material_SPU::buildable_glass_Id;
if(m == Material::heavyMetal) return Material_SPU::heavyMetal_Id;
assert(0);
assert(0);
return Material_SPU::air_Id;
}
@@ -364,12 +364,12 @@ void ChunkRebuildData::createTileData()
// recordPlayer
setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, ((RecordPlayerTile*)Tile::recordPlayer)->iconTop);
// pumpkin
// pumpkin
setIconSPUFromIcon(&m_tileData.pumpkinTile_iconTop, ((PumpkinTile*)Tile::pumpkin)->iconTop);
setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFace, ((PumpkinTile*)Tile::pumpkin)->iconFace);
setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFaceLit, ((PumpkinTile*)Tile::litPumpkin)->iconFace);
// cakeTile
// cakeTile
setIconSPUFromIcon(&m_tileData.cakeTile_iconTop, ((CakeTile*)Tile::cake)->iconTop);
setIconSPUFromIcon(&m_tileData.cakeTile_iconBottom, ((CakeTile*)Tile::cake)->iconBottom);
setIconSPUFromIcon(&m_tileData.cakeTile_iconInner, ((CakeTile*)Tile::cake)->iconInner);
@@ -509,7 +509,7 @@ void ChunkRebuildData::buildForChunk( Region* region, Level* level, int x0, int
// assert(index < 400);
int cacheBlockIndex = (cacheMap[iZ-m_z0]*3) + cacheMap[iX-m_x0];
BiomeCache::Block* pCacheBlock = cacheBlocks[cacheBlockIndex];
// assert(region->getBiomeSource()->getBlockAt(iX, iZ) == pCacheBlock);
// assert(region->getBiomeSource()->getBlockAt(iX, iZ) == pCacheBlock);
Biome* pBiome = pCacheBlock->getBiome(iX, iZ);
m_grassColor[index] = pColourTable->getColor(pBiome->m_grassColor);
m_foliageColor[index] = pColourTable->getColor(pBiome->m_foliageColor);
@@ -537,7 +537,7 @@ void ChunkRebuildData::copyFromTesselator()
m_tesselator.m_PPUOffset = 0;
// copy tesselator vars over
m_tesselator.vertices = t->vertices;
m_tesselator.vertices = t->vertices;
m_tesselator.u = t->u;
m_tesselator.v = t->v;
m_tesselator._tex2 = t->_tex2;
@@ -588,7 +588,7 @@ void ChunkRebuildData::storeInTesselator()
Tesselator* t = Tesselator::getInstance(); // 4J - added - static initialiser being set at the wrong time
// copy tesselator vars over
t->vertices = m_tesselator.vertices;
t->vertices = m_tesselator.vertices;
t->u = m_tesselator.u;
t->v = m_tesselator.v;
t->_tex2 = m_tesselator._tex2;
@@ -647,7 +647,7 @@ void ChunkRebuildData::tesselateAllTiles(TileRenderer_SPU* pTileRenderer)
{
// if (m_currentLayer == 0 && m_tileData.isEntityTile[tileId])
// {
// shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
// std::shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
// if (TileEntityRenderDispatcher::instance->hasRenderer(et))
// {
// renderableTileEntities.push_back(et);
@@ -801,7 +801,7 @@ int ChunkRebuildData::getBrightnessPropagate(LightLayer::variety layer, int x, i
if(layer == LightLayer::Sky)
return getBrightnessSky(x, y, z);
return getBrightnessBlock(x, y, z);
}
int ChunkRebuildData::getLightColor(int x, int y, int z, int emitt) // 4J - change brought forward from 1.8.2
{
@@ -865,7 +865,7 @@ int ChunkRebuildData::getRawBrightness(int x, int y, int z, bool propagate)
int ChunkRebuildData::LevelChunk_getRawBrightness(int x, int y, int z, int skyDampen)
{
int light = (m_flags & e_flag_HasCeiling) ? 0 : getBrightnessSky(x, y, z);
if (light > 0)
if (light > 0)
m_flags |= e_flag_TouchedSky;
light -= skyDampen;
int block = getBrightnessBlock(x, y, z);

View File

@@ -8,5 +8,5 @@ public:
virtual bool blocksLight() { return false; }
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
virtual int getRenderShape() { return Tile_SPU::SHAPE_LEVER; }
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
};

View File

@@ -12,7 +12,7 @@ public:
virtual int getRenderShape() { return SHAPE_PISTON_BASE; }
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
// virtual void updateDefaultShape();
};

View File

@@ -9,5 +9,5 @@ public:
virtual Icon_SPU *getTexture(int face, int data) { return NULL; }
virtual int getRenderShape() { return SHAPE_PISTON_EXTENSION; }
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
};

View File

@@ -6,7 +6,7 @@ class TheEndPortal_SPU : public EntityTile_SPU
public:
TheEndPortal_SPU(int id) : EntityTile_SPU(id) {}
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr<TileEntity> forceEntity = std::shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
{
if (face != 0) return false;

View File

@@ -118,14 +118,14 @@ float Tile_SPU::getBrightness(ChunkRebuildData *level, int x, int y, int z)
{
return level->getBrightness(x, y, z, ms_pTileData->lightEmission[id]);
}
//
//
// // 4J - brought forward from 1.8.2
int Tile_SPU::getLightColor(ChunkRebuildData *level, int x, int y, int z)
{
int tileID = level->getTile(x, y, z);
return level->getLightColor(x, y, z, ms_pTileData->lightEmission[tileID]);
}
//
//
// bool Tile_SPU::isFaceVisible(Level *level, int x, int y, int z, int f)
// {
// if (f == 0) y--;
@@ -136,7 +136,7 @@ int Tile_SPU::getLightColor(ChunkRebuildData *level, int x, int y, int z)
// if (f == 5) x++;
// return !level->isSolidRenderTile(x, y, z);
// }
//
//
bool Tile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
{
if (face == 0 && getShapeY0() > 0) return true;
@@ -147,7 +147,7 @@ bool Tile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, in
if (face == 5 && getShapeX1() < 1) return true;
return (!level->isSolidRenderTile(x, y, z));
}
//
//
bool Tile_SPU::isSolidFace(ChunkRebuildData *level, int x, int y, int z, int face)
{
return (level->getMaterial(x, y, z)->isSolid());
@@ -196,39 +196,39 @@ Icon_SPU *Tile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int
}
return getTexture(face, tileData);
}
//
//
Icon_SPU *Tile_SPU::getTexture(int face, int data)
{
return &ms_pTileData->iconData[id];
}
//
//
Icon_SPU *Tile_SPU::getTexture(int face)
{
return getTexture(face, 0);
}
//
//
// AABB *Tile_SPU::getTileAABB(Level *level, int x, int y, int z)
// {
// return AABB::newTemp(x + xx0, y + yy0, z + zz0, x + xx1, y + yy1, z + zz1);
// }
//
// void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, Entity *source)
//
// void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, Entity *source)
// {
// AABB *aabb = getAABB(level, x, y, z);
// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb);
// }
//
//
// void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes)
// {
// AABB *aabb = getAABB(level, x, y, z);
// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb);
// }
//
//
// AABB *Tile_SPU::getAABB(Level *level, int x, int y, int z)
// {
// return AABB::newTemp(x + xx0, y + yy0, z + zz0, x + xx1, y + yy1, z + zz1);
// }
//
//
bool Tile_SPU::isSolidRender(bool isServerLevel)
{
return true;
@@ -239,67 +239,67 @@ Icon_SPU *Tile_SPU::getTexture(int face)
// {
// return mayPick();
// }
//
//
// bool Tile_SPU::mayPick()
// {
// return true;
// }
//
//
// void Tile_SPU::tick(Level *level, int x, int y, int z, Random *random)
// {
// }
//
//
// void Tile_SPU::animateTick(Level *level, int x, int y, int z, Random *random)
// {
// }
//
//
// void Tile_SPU::destroy(Level *level, int x, int y, int z, int data)
// {
// }
//
//
// void Tile_SPU::neighborChanged(Level *level, int x, int y, int z, int type)
// {
// }
//
//
// void Tile_SPU::addLights(Level *level, int x, int y, int z)
// {
// }
//
//
// int Tile_SPU::getTickDelay()
// {
// return 10;
// }
//
//
// void Tile_SPU::onPlace(Level *level, int x, int y, int z)
// {
// }
//
//
// void Tile_SPU::onRemove(Level *level, int x, int y, int z)
// {
// }
//
//
// int Tile_SPU::getResourceCount(Random *random)
// {
// return 1;
// }
//
//
// int Tile_SPU::getResource(int data, Random *random, int playerBonusLevel)
// {
// return id;
// }
//
// float Tile_SPU::getDestroyProgress(shared_ptr<Player> player)
//
// float Tile_SPU::getDestroyProgress(std::shared_ptr<Player> player)
// {
// if (destroySpeed < 0) return 0;
// if (!player->canDestroy(this)) return 1 / destroySpeed / 100.0f;
// return (player->getDestroySpeed(this) / destroySpeed) / 30;
// }
//
//
// void Tile_SPU::spawnResources(Level *level, int x, int y, int z, int data, int playerBonusLevel)
// {
// spawnResources(level, x, y, z, data, 1, playerBonusLevel);
// }
//
//
// void Tile_SPU::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel)
// {
// if (level->isClientSide) return;
@@ -309,24 +309,24 @@ Icon_SPU *Tile_SPU::getTexture(int face)
// if (level->random->nextFloat() > odds) continue;
// int type = getResource(data, level->random, playerBonusLevel);
// if (type <= 0) continue;
//
// popResource(level, x, y, z, shared_ptr<ItemInstance>( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) );
//
// popResource(level, x, y, z, std::shared_ptr<ItemInstance>( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) );
// }
// }
//
// void Tile_SPU::popResource(Level *level, int x, int y, int z, shared_ptr<ItemInstance> itemInstance)
//
// void Tile_SPU::popResource(Level *level, int x, int y, int z, std::shared_ptr<ItemInstance> itemInstance)
// {
// if( level->isClientSide ) return;
//
//
// float s = 0.7f;
// double xo = level->random->nextFloat() * s + (1 - s) * 0.5;
// double yo = level->random->nextFloat() * s + (1 - s) * 0.5;
// double zo = level->random->nextFloat() * s + (1 - s) * 0.5;
// shared_ptr<ItemEntity> item = shared_ptr<ItemEntity>( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) );
// std::shared_ptr<ItemEntity> item = std::shared_ptr<ItemEntity>( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) );
// item->throwTime = 10;
// level->addEntity(item);
// }
//
//
// // Brought forward for TU7
// void Tile_SPU::popExperience(Level *level, int x, int y, int z, int amount)
// {
@@ -336,182 +336,182 @@ Icon_SPU *Tile_SPU::getTexture(int face)
// {
// int newCount = ExperienceOrb::getExperienceValue(amount);
// amount -= newCount;
// level->addEntity(shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount)));
// level->addEntity(std::shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount)));
// }
// }
// }
//
//
// int Tile_SPU::getSpawnResourcesAuxValue(int data)
// {
// return 0;
// }
//
// float Tile_SPU::getExplosionResistance(shared_ptr<Entity> source)
//
// float Tile_SPU::getExplosionResistance(std::shared_ptr<Entity> source)
// {
// return explosionResistance / 5.0f;
// }
//
//
// HitResult *Tile_SPU::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b)
// {
// EnterCriticalSection(&m_csShape);
// updateShape(level, xt, yt, zt);
//
//
// a = a->add(-xt, -yt, -zt);
// b = b->add(-xt, -yt, -zt);
//
//
// Vec3 *xh0 = a->clipX(b, xx0);
// Vec3 *xh1 = a->clipX(b, xx1);
//
//
// Vec3 *yh0 = a->clipY(b, yy0);
// Vec3 *yh1 = a->clipY(b, yy1);
//
//
// Vec3 *zh0 = a->clipZ(b, zz0);
// Vec3 *zh1 = a->clipZ(b, zz1);
//
//
// Vec3 *closest = NULL;
//
//
// if (containsX(xh0) && (closest == NULL || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0;
// if (containsX(xh1) && (closest == NULL || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1;
// if (containsY(yh0) && (closest == NULL || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0;
// if (containsY(yh1) && (closest == NULL || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1;
// if (containsZ(zh0) && (closest == NULL || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0;
// if (containsZ(zh1) && (closest == NULL || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1;
//
//
// LeaveCriticalSection(&m_csShape);
//
//
// if (closest == NULL) return NULL;
//
//
// int face = -1;
//
//
// if (closest == xh0) face = 4;
// if (closest == xh1) face = 5;
// if (closest == yh0) face = 0;
// if (closest == yh1) face = 1;
// if (closest == zh0) face = 2;
// if (closest == zh1) face = 3;
//
//
// return new HitResult(xt, yt, zt, face, closest->add(xt, yt, zt));
// }
//
//
// bool Tile_SPU::containsX(Vec3 *v)
// {
// if( v == NULL) return false;
// return v->y >= yy0 && v->y <= yy1 && v->z >= zz0 && v->z <= zz1;
// }
//
//
// bool Tile_SPU::containsY(Vec3 *v)
// {
// if( v == NULL) return false;
// return v->x >= xx0 && v->x <= xx1 && v->z >= zz0 && v->z <= zz1;
// }
//
//
// bool Tile_SPU::containsZ(Vec3 *v)
// {
// if( v == NULL) return false;
// return v->x >= xx0 && v->x <= xx1 && v->y >= yy0 && v->y <= yy1;
// }
//
//
// void Tile_SPU::wasExploded(Level *level, int x, int y, int z)
// {
// }
//
//
int Tile_SPU::getRenderLayer()
{
return 0;
}
//
//
// bool Tile_SPU::mayPlace(Level *level, int x, int y, int z, int face)
// {
// return mayPlace(level, x, y, z);
// }
//
//
// bool Tile_SPU::mayPlace(Level *level, int x, int y, int z)
// {
// int t = level->getTile(x, y, z);
// return t == 0 || Tile_SPU::tiles[t]->material->isReplaceable();
// }
//
//
// // 4J-PB - Adding a TestUse for tooltip display
// bool Tile_SPU::TestUse()
// {
// return false;
// }
//
// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, shared_ptr<Player> player)
//
// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
// {
// return false;
// }
//
// bool Tile_SPU::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
//
// bool Tile_SPU::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
// {
// return false;
// }
//
// void Tile_SPU::stepOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
//
// void Tile_SPU::stepOn(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity)
// {
// }
//
//
// void Tile_SPU::setPlacedOnFace(Level *level, int x, int y, int z, int face)
// {
// }
//
//
// void Tile_SPU::prepareRender(Level *level, int x, int y, int z)
// {
// }
//
// void Tile_SPU::attack(Level *level, int x, int y, int z, shared_ptr<Player> player)
//
// void Tile_SPU::attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
// {
// }
//
// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, shared_ptr<Entity> e, Vec3 *current)
//
// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr<Entity> e, Vec3 *current)
// {
// }
//
//
void Tile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
{
}
//
//
int Tile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z)
{
return 0xffffff;
}
//
//
// int Tile_SPU::getColor(LevelSource *level, int x, int y, int z, int data)
// {
// return 0xffffff;
// }
//
//
// bool Tile_SPU::getSignal(LevelSource *level, int x, int y, int z)
// {
// return false;
// }
//
//
// bool Tile_SPU::getSignal(LevelSource *level, int x, int y, int z, int dir)
// {
// return false;
// }
//
//
// bool Tile_SPU::isSignalSource()
// {
// return false;
// }
//
// void Tile_SPU::entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
//
// void Tile_SPU::entityInside(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity)
// {
// }
//
//
// bool Tile_SPU::getDirectSignal(Level *level, int x, int y, int z, int dir)
// {
// return false;
// }
//
//
void Tile_SPU::updateDefaultShape()
{
}
//
// void Tile_SPU::playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data)
//
// void Tile_SPU::playerDestroy(Level *level, std::shared_ptr<Player> player, int x, int y, int z, int data)
// {
// // 4J Stu - Special case - only record a crop destroy if is fully grown
// if(id==Tile_SPU::crops_Id)
@@ -525,14 +525,14 @@ void Tile_SPU::updateDefaultShape()
// }
// player->awardStat(Stats::totalBlocksMined, 1); // 4J : WESTY : Added for other award.
// player->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE);
//
//
// if( id == Tile_SPU::treeTrunk_Id )
// player->awardStat(Achievements::mineWood);
//
//
//
//
// if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory))
// {
// shared_ptr<ItemInstance> item = getSilkTouchItemInstance(data);
// std::shared_ptr<ItemInstance> item = getSilkTouchItemInstance(data);
// if (item != NULL)
// {
// popResource(level, x, y, z, item);
@@ -544,78 +544,78 @@ void Tile_SPU::updateDefaultShape()
// spawnResources(level, x, y, z, data, playerBonusLevel);
// }
// }
//
// shared_ptr<ItemInstance> Tile_SPU::getSilkTouchItemInstance(int data)
//
// std::shared_ptr<ItemInstance> Tile_SPU::getSilkTouchItemInstance(int data)
// {
// int popData = 0;
// if (id >= 0 && id < Item::items.length && Item::items[id]->isStackedByData())
// {
// popData = data;
// }
// return shared_ptr<ItemInstance>(new ItemInstance(id, 1, popData));
// return std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, popData));
// }
//
//
// int Tile_SPU::getResourceCountForLootBonus(int bonusLevel, Random *random)
// {
// return getResourceCount(random);
// }
//
//
// bool Tile_SPU::canSurvive(Level *level, int x, int y, int z)
// {
// return true;
// }
//
// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by)
//
// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<Mob> by)
// {
// }
//
//
// Tile *Tile_SPU::setDescriptionId(unsigned int id)
// {
// this->descriptionId = id;
// return this;
// }
//
//
// wstring Tile_SPU::getName()
// {
// return I18n::get(getDescriptionId() + L".name");
// }
//
//
// unsigned int Tile_SPU::getDescriptionId(int iData /*= -1*/)
// {
// return descriptionId;
// }
//
//
// Tile *Tile_SPU::setUseDescriptionId(unsigned int id)
// {
// this->useDescriptionId = id;
// return this;
// }
//
//
// unsigned int Tile_SPU::getUseDescriptionId()
// {
// return useDescriptionId;
// }
//
//
// void Tile_SPU::triggerEvent(Level *level, int x, int y, int z, int b0, int b1)
// {
// }
//
//
// bool Tile_SPU::isCollectStatistics()
// {
// return collectStatistics;
// }
//
//
// Tile *Tile_SPU::setNotCollectStatistics()
// {
// collectStatistics = false;
// return this;
// }
//
//
// int Tile_SPU::getPistonPushReaction()
// {
// return material->getPushReaction();
// }
//
//
// // 4J - brought forward from 1.8.2
float Tile_SPU::getShadeBrightness(ChunkRebuildData *level, int x, int y, int z)
{
@@ -629,37 +629,37 @@ Tile_SPU* Tile_SPU::createFromID( int tileID )
if(m_tiles[tileID].id != -1)
return &m_tiles[tileID];
#ifndef SN_TARGET_PS3_SPU
app.DebugPrintf("missing tile ID %d\n", tileID);
#else
spu_print("missing tile ID %d\n", tileID);
#endif
#endif
return &m_tiles[1];
}
Material_SPU* Tile_SPU::getMaterial()
{
int matID = ms_pTileData->materialIDs[id];
int matID = ms_pTileData->materialIDs[id];
return &ms_pTileData->materials[matID];
}
//
// void Tile_SPU::fallOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity, float fallDistance)
//
// void Tile_SPU::fallOn(Level *level, int x, int y, int z, std::shared_ptr<Entity> entity, float fallDistance)
// {
// }
//
//
// void Tile_SPU::registerIcons(IconRegister *iconRegister)
// {
// icon = iconRegister->registerIcon(m_textureName);
// }
//
//
// wstring Tile_SPU::getTileItemIconName()
// {
// return L"";
// }
//
//
// Tile *Tile_SPU::setTextureName(const wstring &name)
// {
// m_textureName = name;
@@ -690,7 +690,7 @@ void Tile_SPU::initTilePointers()
CREATE_TILE_TYPE(stairs_wood_Id, StairTile_SPU);
CREATE_TILE_TYPE(stairs_stone_Id, StairTile_SPU);
CREATE_TILE_TYPE(stairs_bricks_Id, StairTile_SPU);
CREATE_TILE_TYPE(stairs_bricks_Id, StairTile_SPU);
CREATE_TILE_TYPE(stairs_stoneBrickSmooth_Id, StairTile_SPU);
CREATE_TILE_TYPE(stairs_netherBricks_Id, StairTile_SPU);
CREATE_TILE_TYPE(stairs_sandstone_Id, StairTile_SPU);
@@ -863,7 +863,7 @@ void Tile_SPU::initTilePointers()
CREATE_TILE_TYPE(goldOre_Id, Tile_SPU); // OreTile
CREATE_TILE_TYPE(ironOre_Id, Tile_SPU); // OreTile
CREATE_TILE_TYPE(coalOre_Id, Tile_SPU); // OreTile
CREATE_TILE_TYPE(lapisOre_Id, Tile_SPU); // OreTile
CREATE_TILE_TYPE(lapisOre_Id, Tile_SPU); // OreTile
CREATE_TILE_TYPE(diamondOre_Id, Tile_SPU); // OreTile
CREATE_TILE_TYPE(clay_Id, Tile_SPU); // ClayTile
CREATE_TILE_TYPE(redStoneOre_Id, Tile_SPU); // RedStoneOreTile
@@ -884,7 +884,7 @@ void Tile_SPU::initTilePointers()
CREATE_TILE_TYPE(enderChest_Id, EnderChestTile_SPU);
CREATE_TILE_TYPE(tripWireSource_Id, TripWireSourceTile_SPU);
CREATE_TILE_TYPE(tripWire_Id, TripWireTile_SPU);
//
//
CREATE_TILE_TYPE(emeraldBlock_Id, Tile_SPU); // MetalTile
CREATE_TILE_TYPE(cobbleWall_Id, WallTile_SPU);
CREATE_TILE_TYPE(flowerPot_Id, FlowerPotTile_SPU);