mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-27 12:03:36 +00:00
cleanup: flatten dead branches in world io level network and stats
This commit is contained in:
parent
12ff12a263
commit
8d3c504ee6
|
|
@ -65,9 +65,4 @@ protected:
|
|||
static const int AttributeNames[];
|
||||
};
|
||||
|
||||
#if 0
|
||||
typedef std::unordered_map<eATTRIBUTE_ID, AttributeModifier*, std::hash<int>>
|
||||
attrAttrModMap;
|
||||
#else
|
||||
typedef std::unordered_map<eATTRIBUTE_ID, AttributeModifier*> attrAttrModMap;
|
||||
#endif
|
||||
|
|
@ -5,12 +5,7 @@ class ModifiableAttributeInstance;
|
|||
class BaseAttributeMap {
|
||||
protected:
|
||||
// unordered_map<Attribute *, AttributeInstance *> attributesByObject;
|
||||
#if 0
|
||||
std::unordered_map<eATTRIBUTE_ID, AttributeInstance*, std::hash<int> >
|
||||
attributesById;
|
||||
#else
|
||||
std::unordered_map<eATTRIBUTE_ID, AttributeInstance*> attributesById;
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual ~BaseAttributeMap();
|
||||
|
|
|
|||
|
|
@ -345,11 +345,6 @@ void FireTile::registerIcons(IconRegister* iconRegister) {
|
|||
}
|
||||
|
||||
Icon* FireTile::getTextureLayer(int layer) {
|
||||
#if 0
|
||||
// AP - alpha cut out is expensive on vita. Set the Alpha Cut out flag
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
t->setAlphaCutOut(true);
|
||||
#endif
|
||||
|
||||
return icons[layer];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,13 +110,6 @@ int GrassTile::getResource(int data, Random* random, int playerBonusLevel) {
|
|||
}
|
||||
|
||||
Icon* GrassTile::getSideTextureOverlay() {
|
||||
#if 0
|
||||
// AP - alpha cut out is expensive on vita. Because of the way grass sides
|
||||
// are treated as special case we need to set the alpha flag here this would
|
||||
// normally happen in TileRenderer::getTextureOrMissing
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
t->setAlphaCutOut(true);
|
||||
#endif
|
||||
|
||||
return Tile::grass->iconSideOverlay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,67 +32,13 @@ TilePos MobSpawner::getRandomPosWithin(Level* level, int cx, int cz) {
|
|||
return TilePos(x, y, z);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// AP - See CustomMap.h for an explanation of this
|
||||
CustomMap MobSpawner::chunksToPoll;
|
||||
#else
|
||||
std::unordered_map<ChunkPos, bool, ChunkPosKeyHash, ChunkPosKeyEq>
|
||||
MobSpawner::chunksToPoll;
|
||||
#endif
|
||||
|
||||
const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
||||
bool spawnFriendlies, bool spawnPersistent) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
|
||||
#if 0
|
||||
// PIX output for mob counters - generally disabling as Entity::countFlagsForPIX is reasonably expensive
|
||||
if( level->dimension->id == 0 )
|
||||
{
|
||||
Entity::countFlagsForPIX();
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_WATERANIMAL ,false), "eTYPE_WATERANIMAL");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ,false), "eTYPE_ANIMAL");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_MONSTER ,false), "eTYPE_MONSTER");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_SQUID ,true ), "eTYPE_SQUID");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_VILLAGER ,true ), "eTYPE_VILLAGER");
|
||||
|
||||
unsigned int totalCount[4];
|
||||
unsigned int protectedCount[4];
|
||||
unsigned int unprotectedCount[4];
|
||||
unsigned int couldWanderCount[4];
|
||||
|
||||
totalCount[0] = level->countInstanceOf(eTYPE_COW ,true, &protectedCount[0], &couldWanderCount[0] );
|
||||
totalCount[1] = level->countInstanceOf(eTYPE_SHEEP ,true, &protectedCount[1], &couldWanderCount[1] );
|
||||
totalCount[2] = level->countInstanceOf(eTYPE_CHICKEN ,true, &protectedCount[2], &couldWanderCount[2] );
|
||||
totalCount[3] = level->countInstanceOf(eTYPE_PIG ,true, &protectedCount[3], &couldWanderCount[3] );
|
||||
|
||||
for( int i = 0; i < 4; i++ ) unprotectedCount[i] = totalCount[i] - protectedCount[i];
|
||||
|
||||
PIXAddNamedCounter( unprotectedCount[0], "eTYPE_COW (unprotected)");
|
||||
PIXAddNamedCounter( unprotectedCount[1], "eTYPE_SHEEP (unprotected)");
|
||||
PIXAddNamedCounter( unprotectedCount[2], "eTYPE_CHICKEN (unprotected)");
|
||||
PIXAddNamedCounter( unprotectedCount[3], "eTYPE_PIG (unprotected)");
|
||||
|
||||
PIXAddNamedCounter( protectedCount[0], "eTYPE_COW (protected)");
|
||||
PIXAddNamedCounter( protectedCount[1], "eTYPE_SHEEP (protected)");
|
||||
PIXAddNamedCounter( protectedCount[2], "eTYPE_CHICKEN (protected)");
|
||||
PIXAddNamedCounter( protectedCount[3], "eTYPE_PIG (protected)");
|
||||
|
||||
PIXAddNamedCounter( couldWanderCount[0], "eTYPE_COW (could wander)");
|
||||
PIXAddNamedCounter( couldWanderCount[1], "eTYPE_SHEEP (could wander)");
|
||||
PIXAddNamedCounter( couldWanderCount[2], "eTYPE_CHICKEN (could wander)");
|
||||
PIXAddNamedCounter( couldWanderCount[3], "eTYPE_PIG (could wander)");
|
||||
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_WOLF ,true ), "eTYPE_WOLF");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_CREEPER ,true ), "eTYPE_CREEPER");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_GIANT ,true ), "eTYPE_GIANT");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_SKELETON ,true ), "eTYPE_SKELETON");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_SPIDER ,true ), "eTYPE_SPIDER");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_ZOMBIE ,true ), "eTYPE_ZOMBIE");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_PIGZOMBIE ,true ), "eTYPE_PIGZOMBIE");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_SLIME ,true ), "eTYPE_SLIME");
|
||||
PIXAddNamedCounter( level->countInstanceOf(eTYPE_GHAST ,true ), "eTYPE_GHAST");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!spawnEnemies && !spawnFriendlies && !spawnPersistent) {
|
||||
|
|
@ -101,22 +47,6 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
|||
MemSect(20);
|
||||
chunksToPoll.clear();
|
||||
|
||||
#if 0
|
||||
AUTO_VAR(itEnd, level->players.end());
|
||||
for (AUTO_VAR(it, level->players.begin()); it != itEnd; it++)
|
||||
{
|
||||
std::shared_ptr<Player> player = *it; //level->players.at(i);
|
||||
int xx = Mth::floor(player->x / 16);
|
||||
int zz = Mth::floor(player->z / 16);
|
||||
|
||||
int r = 128 / 16;
|
||||
for (int x = -r; x <= r; x++)
|
||||
for (int z = -r; z <= r; z++)
|
||||
{
|
||||
chunksToPoll.insert(ChunkPos(x + xx, z + zz));
|
||||
}
|
||||
}
|
||||
#else
|
||||
// 4J - rewritten to add chunks interleaved by player, and to add them from
|
||||
// the centre outwards. We're going to be potentially adding less creatures
|
||||
// than the original so that our count stays consistent with number of
|
||||
|
|
@ -129,12 +59,8 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
|||
std::shared_ptr<Player> player = level->players[i];
|
||||
xx[i] = Mth::floor(player->x / 16);
|
||||
zz[i] = Mth::floor(player->z / 16);
|
||||
#if 0
|
||||
chunksToPoll.insert(ChunkPos(xx[i], zz[i]), false);
|
||||
#else
|
||||
chunksToPoll.insert(
|
||||
std::pair<ChunkPos, bool>(ChunkPos(xx[i], zz[i]), false));
|
||||
#endif
|
||||
}
|
||||
|
||||
for (int r = 1; r <= 8; r++) {
|
||||
|
|
@ -146,16 +72,6 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
|||
// player, then always store with a flag of false so that if it
|
||||
// was at the edge of another player, then this will remove that
|
||||
if (!edgeChunk) {
|
||||
#if 0
|
||||
chunksToPoll.insert(ChunkPos((xx[i] - r) + l, (zz[i] - r)),
|
||||
false);
|
||||
chunksToPoll.insert(ChunkPos((xx[i] + r), (zz[i] - r) + l),
|
||||
false);
|
||||
chunksToPoll.insert(ChunkPos((xx[i] + r) - l, (zz[i] + r)),
|
||||
false);
|
||||
chunksToPoll.insert(ChunkPos((xx[i] - r), (zz[i] + r) - l),
|
||||
false);
|
||||
#else
|
||||
chunksToPoll.insert(std::pair<ChunkPos, bool>(
|
||||
ChunkPos((xx[i] - r) + l, (zz[i] - r)), false));
|
||||
chunksToPoll.insert(std::pair<ChunkPos, bool>(
|
||||
|
|
@ -164,18 +80,7 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
|||
ChunkPos((xx[i] + r) - l, (zz[i] + r)), false));
|
||||
chunksToPoll.insert(std::pair<ChunkPos, bool>(
|
||||
ChunkPos((xx[i] - r), (zz[i] + r) - l), false));
|
||||
#endif
|
||||
} else {
|
||||
#if 0
|
||||
ChunkPos cp = ChunkPos((xx[i] - r) + l, (zz[i] - r));
|
||||
if (chunksToPoll.find(cp)) chunksToPoll.insert(cp, true);
|
||||
cp = ChunkPos((xx[i] + r), (zz[i] - r) + l);
|
||||
if (chunksToPoll.find(cp)) chunksToPoll.insert(cp, true);
|
||||
cp = ChunkPos((xx[i] + r) - l, (zz[i] + r));
|
||||
if (chunksToPoll.find(cp)) chunksToPoll.insert(cp, true);
|
||||
cp = ChunkPos((xx[i] - r), (zz[i] + r) - l);
|
||||
if (chunksToPoll.find(cp)) chunksToPoll.insert(cp, true);
|
||||
#else
|
||||
ChunkPos cp = ChunkPos((xx[i] - r) + l, (zz[i] - r));
|
||||
if (chunksToPoll.find(cp) == chunksToPoll.end())
|
||||
chunksToPoll.insert(
|
||||
|
|
@ -192,14 +97,12 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
|||
if (chunksToPoll.find(cp) == chunksToPoll.end())
|
||||
chunksToPoll.insert(
|
||||
std::pair<ChunkPos, bool>(cp, true));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete[] xx;
|
||||
delete[] zz;
|
||||
#endif
|
||||
MemSect(0);
|
||||
int count = 0;
|
||||
MemSect(31);
|
||||
|
|
@ -230,13 +133,8 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
|||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
for (int i = 0; i < chunksToPoll.end(); i += 1) {
|
||||
SCustomMapNode* it = chunksToPoll.get(i);
|
||||
#else
|
||||
AUTO_VAR(itEndCTP, chunksToPoll.end());
|
||||
for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCTP; it++) {
|
||||
#endif
|
||||
if (it->second) {
|
||||
// don't add mobs to edge chunks, to prevent adding mobs
|
||||
// "outside" of the active playground
|
||||
|
|
@ -435,15 +333,6 @@ bool MobSpawner::isSpawnPositionOk(MobCategory* category, Level* level, int x,
|
|||
// can happen on another thread
|
||||
if (!level->hasChunkAt(x, y, z)) return false;
|
||||
|
||||
#if 0
|
||||
// AP - added this for Vita. Make sure a new spawn point has 2 chunks around
|
||||
// it. This will make sure monsters don't keep getting spawned on the edge
|
||||
// preventing other new monsters from being spawned
|
||||
int r = 32;
|
||||
if (!level->hasChunksAt(x - r, 0, z - r, x + r, 0, z + r)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (category->getSpawnPositionMaterial() == Material::water) {
|
||||
// 4J - changed to spawn water things only in deep water
|
||||
|
|
@ -482,64 +371,4 @@ void MobSpawner::postProcessSpawnMobs(Level* level, Biome* biome, int xo,
|
|||
int zo, int cellWidth, int cellHeight,
|
||||
Random* random) {
|
||||
// 4J - not for our version. Creates a few too many mobs.
|
||||
#if 0
|
||||
std::vector<Biome::MobSpawnerData *> *mobs = biome->getMobs(MobCategory::creature);
|
||||
if (mobs->empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (random->nextFloat() < biome->getCreatureProbability())
|
||||
{
|
||||
Biome::MobSpawnerData *type = (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(level->random, ((std::vector<WeighedRandomItem *> *)mobs));
|
||||
MobGroupData *groupData = NULL;
|
||||
int count = type->minCount + random->nextInt(1 + type->maxCount - type->minCount);
|
||||
|
||||
int x = xo + random->nextInt(cellWidth);
|
||||
int z = zo + random->nextInt(cellHeight);
|
||||
int startX = x, startZ = z;
|
||||
|
||||
for (int c = 0; c < count; c++)
|
||||
{
|
||||
bool success = false;
|
||||
for (int attempts = 0; !success && attempts < 4; attempts++)
|
||||
{
|
||||
// these mobs always spawn at the topmost position
|
||||
int y = level->getTopSolidBlock(x, z);
|
||||
if (isSpawnPositionOk(MobCategory::creature, level, x, y, z))
|
||||
{
|
||||
|
||||
float xx = x + 0.5f;
|
||||
float yy = (float)y;
|
||||
float zz = z + 0.5f;
|
||||
|
||||
std::shared_ptr<Mob> mob;
|
||||
//try {
|
||||
mob = std::dynamic_pointer_cast<Mob>( EntityIO::newByEnumType(type->mobClass, level ) );
|
||||
//} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// System.out.println("Placing night mob");
|
||||
mob->moveTo(xx, yy, zz, random->nextFloat() * 360, 0);
|
||||
|
||||
mob->setDespawnProtected();
|
||||
|
||||
level->addEntity(mob);
|
||||
groupData = mob->finalizeMobSpawn(groupData);
|
||||
success = true;
|
||||
}
|
||||
|
||||
x += random->nextInt(5) - random->nextInt(5);
|
||||
z += random->nextInt(5) - random->nextInt(5);
|
||||
while (x < xo || x >= (xo + cellWidth) || z < zo || z >= (zo + cellWidth))
|
||||
{
|
||||
x = startX + random->nextInt(5) - random->nextInt(5);
|
||||
z = startZ + random->nextInt(5) - random->nextInt(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,8 @@ protected:
|
|||
static TilePos getRandomPosWithin(Level* level, int cx, int cz);
|
||||
|
||||
private:
|
||||
#if 0
|
||||
// AP - See CustomMap.h for an explanation of this
|
||||
static CustomMap chunksToPoll;
|
||||
#else
|
||||
static std::unordered_map<ChunkPos, bool, ChunkPosKeyHash, ChunkPosKeyEq>
|
||||
chunksToPoll;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static const int tick(ServerLevel* level, bool spawnEnemies,
|
||||
|
|
|
|||
|
|
@ -419,11 +419,6 @@ void RedStoneDustTile::registerIcons(IconRegister* iconRegister) {
|
|||
}
|
||||
|
||||
Icon* RedStoneDustTile::getTexture(const std::wstring& name) {
|
||||
#if 0
|
||||
// AP - alpha cut out is expensive on vita. Set the Alpha Cut out flag
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
t->setAlphaCutOut(true);
|
||||
#endif
|
||||
|
||||
if (name.compare(TEXTURE_CROSS) == 0) return Tile::redStoneDust->iconCross;
|
||||
if (name.compare(TEXTURE_LINE) == 0) return Tile::redStoneDust->iconLine;
|
||||
|
|
|
|||
|
|
@ -19,24 +19,9 @@ void CommandBlockEntity::setCommand(const std::wstring& command) {
|
|||
std::wstring CommandBlockEntity::getCommand() { return command; }
|
||||
|
||||
int CommandBlockEntity::performCommand(Level* level) {
|
||||
#if 0
|
||||
if (level->isClientSide)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
MinecraftServer *instance = MinecraftServer::getInstance();
|
||||
if (instance != NULL && instance->isCommandBlockEnabled())
|
||||
{
|
||||
CommandDispatcher *commandDispatcher = instance->getCommandDispatcher();
|
||||
return commandDispatcher->performCommand(std::dynamic_pointer_cast<CommandSender>(shared_from_this()), command, byteArray() );
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
// 4J-JEV: Cannot decide what to do with the command field.
|
||||
assert(false);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring CommandBlockEntity::getName() { return name; }
|
||||
|
|
|
|||
|
|
@ -33,10 +33,8 @@ SignTileEntity::SignTileEntity() : TileEntity() {
|
|||
|
||||
SignTileEntity::~SignTileEntity() {
|
||||
// TODO ORBIS_STUBBED;
|
||||
#if 1
|
||||
// 4J-PB - we don't need to verify strings anymore -
|
||||
// InputManager.CancelQueuedVerifyStrings(&SignTileEntity::StringVerifyCallback,(LPVOID)this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SignTileEntity::save(CompoundTag* tag) {
|
||||
|
|
@ -45,7 +43,7 @@ void SignTileEntity::save(CompoundTag* tag) {
|
|||
tag->putString(L"Text2", m_wsmessages[1]);
|
||||
tag->putString(L"Text3", m_wsmessages[2]);
|
||||
tag->putString(L"Text4", m_wsmessages[3]);
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
OutputDebugStringW(L"### - Saving a sign with text - \n");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
OutputDebugStringW(m_wsmessages[i].c_str());
|
||||
|
|
@ -64,7 +62,7 @@ void SignTileEntity::load(CompoundTag* tag) {
|
|||
if (m_wsmessages[i].length() > MAX_LINE_LENGTH)
|
||||
m_wsmessages[i] = m_wsmessages[i].substr(0, MAX_LINE_LENGTH);
|
||||
}
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
OutputDebugStringW(L"### - Loaded a sign with text - \n");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
OutputDebugStringW(m_wsmessages[i].c_str());
|
||||
|
|
|
|||
|
|
@ -5,11 +5,7 @@ class CommandSender;
|
|||
|
||||
class CommandDispatcher {
|
||||
private:
|
||||
#if 0
|
||||
std::unordered_map<EGameCommand, Command*, std::hash<int>> commandsById;
|
||||
#else
|
||||
std::unordered_map<EGameCommand, Command*> commandsById;
|
||||
#endif
|
||||
std::unordered_set<Command*> commands;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ std::shared_ptr<ItemInstance> ContainerMenu::clicked(
|
|||
std::shared_ptr<ItemInstance> out = AbstractContainerMenu::clicked(
|
||||
slotIndex, buttonNum, clickType, player, looped);
|
||||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
std::shared_ptr<LocalPlayer> localPlayer =
|
||||
std::dynamic_pointer_cast<LocalPlayer>(player);
|
||||
|
||||
|
|
@ -98,14 +98,12 @@ std::shared_ptr<ItemInstance> ContainerMenu::clicked(
|
|||
|
||||
// 4J-JEV: This check performed on XboxOne servers, for other platforms
|
||||
// check here.
|
||||
#if 1
|
||||
StatsCounter* sc =
|
||||
Minecraft::GetInstance()->stats[localPlayer->GetXboxPad()];
|
||||
int minedCount =
|
||||
sc->getTotalValue(GenericStats::blocksMined(Tile::stone_Id)) +
|
||||
sc->getTotalValue(GenericStats::blocksMined(Tile::cobblestone_Id));
|
||||
if (cobblecount >= 1728 && minedCount >= 1728)
|
||||
#endif
|
||||
{
|
||||
localPlayer->awardStat(
|
||||
GenericStats::chestfulOfCobblestone(),
|
||||
|
|
|
|||
|
|
@ -72,21 +72,12 @@ void FurnaceResultSlot::checkTakeAchievements(
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!player->level->isClientSide && removeCount > 0) {
|
||||
player->awardStat(
|
||||
GenericStats::itemsSmelted(carried->id),
|
||||
GenericStats::param_itemsSmelted(
|
||||
carried->id, carried->getAuxValue(), removeCount));
|
||||
}
|
||||
#else
|
||||
if (carried->id == Item::ironIngot_Id)
|
||||
player->awardStat(GenericStats::acquireIron(),
|
||||
GenericStats::param_acquireIron());
|
||||
if (carried->id == Item::fish_cooked_Id)
|
||||
player->awardStat(GenericStats::cookFish(),
|
||||
GenericStats::param_cookFish());
|
||||
#endif
|
||||
|
||||
removeCount = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1218,16 +1218,8 @@ void LivingEntity::jumpFromGround() {
|
|||
}
|
||||
|
||||
void LivingEntity::travel(float xa, float ya) {
|
||||
#if 0
|
||||
// AP - dynamic_pointer_cast is a non-trivial call
|
||||
Player* thisPlayer = NULL;
|
||||
if (this->instanceof(eTYPE_PLAYER)) {
|
||||
thisPlayer = (Player*)this;
|
||||
}
|
||||
#else
|
||||
std::shared_ptr<Player> thisPlayer =
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this());
|
||||
#endif
|
||||
if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying)) {
|
||||
double yo = y;
|
||||
moveRelative(xa, ya, useNewAi() ? 0.04f : 0.02f);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,6 @@ void Boat::tick() {
|
|||
setPos(xt, yt, zt);
|
||||
setRot(yRot, xRot);
|
||||
} else {
|
||||
#if 1
|
||||
// Original
|
||||
// double xt = x + xd;
|
||||
// double yt = y + yd;
|
||||
|
|
@ -230,37 +229,6 @@ void Boat::tick() {
|
|||
xd *= 0.99f;
|
||||
yd *= 0.95f;
|
||||
zd *= 0.99f;
|
||||
#else
|
||||
// 4J Stu - Fix for #8280 - Gameplay : Boats behave erratically when
|
||||
// exited next to land. The client shouldn't change the position of
|
||||
// the boat
|
||||
double xt = x; // + xd;
|
||||
double yt = y + yd;
|
||||
double zt = z; // + zd;
|
||||
this->setPos(xt, yt, zt);
|
||||
|
||||
// 4J Stu - Fix for #9579 - GAMEPLAY: Boats with a player in them
|
||||
// slowly sink under the water over time, and with no player in them
|
||||
// they float into the sky. Just make the boats bob up and down
|
||||
// rather than any other client-side movement when not receiving
|
||||
// packets from server
|
||||
if (waterPercentage < 1) {
|
||||
double bob = waterPercentage * 2 - 1;
|
||||
yd += 0.04f * bob;
|
||||
} else {
|
||||
if (yd < 0) yd /= 2;
|
||||
yd += 0.007f;
|
||||
}
|
||||
// if (onGround)
|
||||
//{
|
||||
xd *= 0.5f;
|
||||
yd *= 0.5f;
|
||||
zd *= 0.5f;
|
||||
//}
|
||||
// xd *= 0.99f;
|
||||
// yd *= 0.95f;
|
||||
// zd *= 0.99f;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,16 +78,6 @@ void SynchedEntityData::defineNULL(int id, void* pVal) {
|
|||
}
|
||||
|
||||
void SynchedEntityData::checkId(int id) {
|
||||
#if 0
|
||||
if (id > MAX_ID_VALUE)
|
||||
{
|
||||
throw new IllegalArgumentException(L"Data value id is too big with " + _toString<int>(id) + L"! (Max is " + _toString<int>(MAX_ID_VALUE) + L")");
|
||||
}
|
||||
if (itemsById.find(id) != itemsById.end())
|
||||
{
|
||||
throw new IllegalArgumentException(L"Duplicate id value for " + _toString<int>(id) + L"!");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t SynchedEntityData::getByte(int id) {
|
||||
|
|
|
|||
|
|
@ -22,36 +22,17 @@ void TamableAnimal::defineSynchedData() {
|
|||
|
||||
void TamableAnimal::addAdditonalSaveData(CompoundTag* tag) {
|
||||
Animal::addAdditonalSaveData(tag);
|
||||
#if 0
|
||||
// 4J Stu Added from later Java version to remove owners from save transfer
|
||||
// saves. We will probably want this on other platforms in the future
|
||||
if (getOwnerUUID().empty()) {
|
||||
tag->putString(L"OwnerUUID", L"");
|
||||
} else {
|
||||
tag->putString(L"OwnerUUID", getOwnerUUID());
|
||||
}
|
||||
#else
|
||||
if (getOwnerUUID().empty()) {
|
||||
tag->putString(L"Owner", L"");
|
||||
} else {
|
||||
tag->putString(L"Owner", getOwnerUUID());
|
||||
}
|
||||
#endif
|
||||
tag->putBoolean(L"Sitting", isSitting());
|
||||
}
|
||||
|
||||
void TamableAnimal::readAdditionalSaveData(CompoundTag* tag) {
|
||||
Animal::readAdditionalSaveData(tag);
|
||||
#if 0
|
||||
// 4J Stu Added from later Java version to remove owners from save transfer
|
||||
// saves. We will probably want this on other platforms in the future
|
||||
std::wstring owner = L"";
|
||||
if (tag->contains(L"OwnerUUID")) {
|
||||
owner = tag->getString(L"OwnerUUID");
|
||||
}
|
||||
#else
|
||||
std::wstring owner = tag->getString(L"Owner");
|
||||
#endif
|
||||
if (owner.length() > 0) {
|
||||
setOwnerUUID(owner);
|
||||
setTame(true);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
virtual void Flush(bool autosave, bool updateThumbnail = true) = 0;
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
virtual void DebugFlushToFile(void* compressedData = NULL,
|
||||
unsigned int compressedDataSize = 0) = 0;
|
||||
#endif
|
||||
|
|
@ -40,13 +40,6 @@ public:
|
|||
virtual std::vector<FileEntry*>* getRegionFilesByDimension(
|
||||
unsigned int dimensionIndex) = 0;
|
||||
|
||||
#if 0 || 0 || 0
|
||||
virtual std::wstring getPlayerDataFilenameForLoad(
|
||||
const PlayerUID& pUID) = 0;
|
||||
virtual std::wstring getPlayerDataFilenameForSave(
|
||||
const PlayerUID& pUID) = 0;
|
||||
virtual std::vector<FileEntry*>* getValidPlayerDatFiles() = 0;
|
||||
#endif //0
|
||||
|
||||
virtual int getSaveVersion() = 0;
|
||||
virtual int getOriginalSaveVersion() = 0;
|
||||
|
|
|
|||
|
|
@ -80,32 +80,15 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave,
|
|||
}
|
||||
|
||||
// MGH added - find any player data files and copy them across
|
||||
#if 0 || 0 || 0
|
||||
std::vector<FileEntry*>* playerFiles = sourceSave->getValidPlayerDatFiles();
|
||||
#else
|
||||
std::vector<FileEntry*>* playerFiles =
|
||||
sourceSave->getFilesWithPrefix(DirectoryLevelStorage::getPlayerDir());
|
||||
#endif
|
||||
|
||||
if (playerFiles != NULL) {
|
||||
for (int fileIdx = 0; fileIdx < playerFiles->size(); fileIdx++) {
|
||||
ConsoleSavePath sourcePlayerDatPath(
|
||||
playerFiles->at(fileIdx)->data.filename);
|
||||
#if 0
|
||||
// 4J Stu - As the XUIDs on X360 and X1 are different, we don't want
|
||||
// to transfer these over. However as the first player file should
|
||||
// be the owner of the save, we can move their data over to the
|
||||
// current players XUID
|
||||
if (fileIdx > 0) break;
|
||||
PlayerUID xuid;
|
||||
ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(), &xuid,
|
||||
false);
|
||||
ConsoleSavePath targetPlayerDatPath(L"players/" + xuid.toString() +
|
||||
L".dat");
|
||||
#else
|
||||
ConsoleSavePath targetPlayerDatPath(
|
||||
playerFiles->at(fileIdx)->data.filename);
|
||||
#endif
|
||||
{
|
||||
FileEntry* sourceFe =
|
||||
sourceSave->createFile(sourcePlayerDatPath);
|
||||
|
|
@ -122,7 +105,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave,
|
|||
delete playerFiles;
|
||||
}
|
||||
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
int xzSize = LEVEL_LEGACY_WIDTH;
|
||||
int hellScale = HELL_LEVEL_LEGACY_SCALE;
|
||||
if (sourceSave->doesFileExist(ldatPath)) {
|
||||
|
|
@ -292,13 +275,13 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave,
|
|||
std::wstring suffix(L".mcr");
|
||||
if (fName.compare(fName.length() - suffix.length(), suffix.length(),
|
||||
suffix) == 0) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"Processing a region file: %s\n", fe->data.filename);
|
||||
#endif
|
||||
ProcessStandardRegionFile(sourceSave, File(fe->data.filename),
|
||||
targetSave, File(fe->data.filename));
|
||||
} else {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"%s is not a region file, ignoring\n",
|
||||
fe->data.filename);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,13 +13,10 @@ private:
|
|||
// HANDLE hHeap;
|
||||
static void* pvHeap;
|
||||
static unsigned int pagesCommitted;
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
static const unsigned int CSF_PAGE_SIZE = 64 * 1024;
|
||||
static const unsigned int MAX_PAGE_COUNT =
|
||||
32 * 1024; // 2GB virtual allocation
|
||||
#elif 0
|
||||
static const unsigned int CSF_PAGE_SIZE = 1024 * 1024;
|
||||
static const unsigned int MAX_PAGE_COUNT = 64;
|
||||
#else
|
||||
static const unsigned int CSF_PAGE_SIZE = 64 * 1024;
|
||||
static const unsigned int MAX_PAGE_COUNT = 1024;
|
||||
|
|
@ -32,8 +29,7 @@ private:
|
|||
void MoveDataBeyond(FileEntry* file, unsigned int nNumberOfBytesToWrite);
|
||||
|
||||
public:
|
||||
#if (0 || 0 || 0 || \
|
||||
0 || defined _WINDOWS64)
|
||||
#if defined(_WINDOWS64)
|
||||
static int SaveSaveDataCallback(void* lpParam, bool bRes);
|
||||
#endif
|
||||
ConsoleSaveFileOriginal(const std::wstring& fileName,
|
||||
|
|
@ -66,7 +62,7 @@ public:
|
|||
|
||||
virtual void Flush(bool autosave, bool updateThumbnail = true);
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
virtual void DebugFlushToFile(void* compressedData = NULL,
|
||||
unsigned int compressedDataSize = 0);
|
||||
#endif
|
||||
|
|
@ -79,11 +75,6 @@ public:
|
|||
virtual std::vector<FileEntry*>* getRegionFilesByDimension(
|
||||
unsigned int dimensionIndex);
|
||||
|
||||
#if 0 || 0 || 0
|
||||
virtual std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID);
|
||||
virtual std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID);
|
||||
virtual std::vector<FileEntry*>* getValidPlayerDatFiles();
|
||||
#endif //0
|
||||
|
||||
virtual int getSaveVersion();
|
||||
virtual int getOriginalSaveVersion();
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData,
|
|||
// save file at a time, and the pages should be decommitted in the dtor, so
|
||||
// pages committed should always be zero at this point.
|
||||
if (pagesCommitted != 0) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -455,7 +455,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData,
|
|||
void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE,
|
||||
COMMIT_ALLOCATION, PAGE_READWRITE);
|
||||
if (pvRet == NULL) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
// Out of physical memory
|
||||
__debugbreak();
|
||||
#endif
|
||||
|
|
@ -516,7 +516,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData,
|
|||
// Corrupt save, although most of the terrain should
|
||||
// actually be ok
|
||||
app.DebugPrintf("Failed to decompress save data!\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
__debugbreak();
|
||||
#endif
|
||||
ZeroMemory(pvSaveMem, fileSize);
|
||||
|
|
@ -541,11 +541,6 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit() {
|
|||
pagesCommitted = 0;
|
||||
// Make sure we don't have any thumbnail data still waiting round - we can't
|
||||
// need it now we've destroyed the save file anyway
|
||||
#if 0
|
||||
app.GetSaveThumbnail(NULL, NULL);
|
||||
#elif 0
|
||||
app.GetSaveThumbnail(NULL, NULL, NULL, NULL);
|
||||
#endif
|
||||
|
||||
for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) {
|
||||
delete it->second;
|
||||
|
|
@ -962,7 +957,7 @@ void ConsoleSaveFileSplit::tick() {
|
|||
|
||||
writeRequired = true;
|
||||
}
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
{
|
||||
unsigned int totalDirty = 0;
|
||||
unsigned int totalDirtyBytes = 0;
|
||||
|
|
@ -976,16 +971,6 @@ void ConsoleSaveFileSplit::tick() {
|
|||
totalDirtyBytes += it->second->fileEntry->getFileSize();
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
PIXReportCounter(L"Dirty regions", (float)totalDirty);
|
||||
PIXReportCounter(L"Dirty MB", (float)totalDirtyBytes / (1024 * 1024));
|
||||
PIXReportCounter(L"Dirty oldest age",
|
||||
((float)currentTime - oldestDirty));
|
||||
PIXReportCounter(L"Region writing bandwidth",
|
||||
((float)bytesInTimePeriod /
|
||||
WRITE_BANDWIDTH_MEASUREMENT_PERIOD_SECONDS) /
|
||||
(1024 * 1024));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1231,22 +1216,6 @@ std::wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier(
|
|||
// Compress any dirty region files, and tell the storage manager about them so
|
||||
// that it will process them when we ask it to save sub files
|
||||
void ConsoleSaveFileSplit::processSubfilesForWrite() {
|
||||
#if 0
|
||||
// 4J Stu - There are debug reasons where we want to force a save of all regions
|
||||
StorageManager.ResetSubfiles();
|
||||
for(AUTO_VAR(it,regionFiles.begin()); it != regionFiles.end(); it++ )
|
||||
{
|
||||
RegionFileReference* region = it->second;
|
||||
int index = StorageManager.AddSubfile(region->fileEntry->data.regionIndex);
|
||||
//if( region->dirty )
|
||||
{
|
||||
region->Compress();
|
||||
StorageManager.UpdateSubfile(index, region->dataCompressed, region->dataCompressedSize);
|
||||
region->dirty = false;
|
||||
region->lastWritten = System::currentTimeMillis();
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) {
|
||||
RegionFileReference* region = it->second;
|
||||
if (region->dirty) {
|
||||
|
|
@ -1257,7 +1226,6 @@ void ConsoleSaveFileSplit::processSubfilesForWrite() {
|
|||
region->lastWritten = System::currentTimeMillis();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Clean up any memory allocated for compressed data when we have finished
|
||||
|
|
@ -1282,20 +1250,10 @@ bool ConsoleSaveFileSplit::doesFileExist(ConsoleSavePath file) {
|
|||
void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
||||
LockSaveAccess();
|
||||
|
||||
#if 0
|
||||
MinecraftServer* server = MinecraftServer::getInstance();
|
||||
#endif
|
||||
|
||||
// The storage manage might potentially be busy doing a sub-file write
|
||||
// initiated from the tick. Wait until this is totally processed.
|
||||
while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle) {
|
||||
#if 0
|
||||
if (server && server->IsSuspending()) {
|
||||
// If the server is mid-suspend we need to tick the storage manager
|
||||
// ourselves
|
||||
StorageManager.Tick();
|
||||
}
|
||||
#endif
|
||||
|
||||
app.DebugPrintf("Flush wait\n");
|
||||
Sleep(10);
|
||||
|
|
@ -1387,12 +1345,6 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
|||
std::uint8_t* pbDataSaveImage = NULL;
|
||||
unsigned int dwDataSizeSaveImage = 0;
|
||||
|
||||
#if (0 || 0)
|
||||
app.GetSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize);
|
||||
#elif (0 || 0)
|
||||
app.GetSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize,
|
||||
&pbDataSaveImage, &dwDataSizeSaveImage);
|
||||
#endif
|
||||
|
||||
std::uint8_t bTextMetadata[88];
|
||||
ZeroMemory(bTextMetadata, 88);
|
||||
|
|
@ -1429,7 +1381,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) {
|
|||
// save the data
|
||||
StorageManager.SaveSaveData(&ConsoleSaveFileSplit::SaveSaveDataCallback,
|
||||
this);
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (app.DebugSettingsOn()) {
|
||||
if (app.GetWriteSavesToFolderEnabled()) {
|
||||
DebugFlushToFile(compData, compLength + 8);
|
||||
|
|
@ -1462,7 +1414,7 @@ int ConsoleSaveFileSplit::SaveRegionFilesCallback(void* lpParam, bool bRes) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
void ConsoleSaveFileSplit::DebugFlushToFile(
|
||||
void* compressedData /*= NULL*/, unsigned int compressedDataSize /*= 0*/) {
|
||||
LockSaveAccess();
|
||||
|
|
@ -1546,19 +1498,6 @@ std::vector<FileEntry*>* ConsoleSaveFileSplit::getRegionFilesByDimension(
|
|||
return files;
|
||||
}
|
||||
|
||||
#if 0 || 0
|
||||
std::wstring ConsoleSaveFileSplit::getPlayerDataFilenameForLoad(
|
||||
const PlayerUID& pUID) {
|
||||
return header.getPlayerDataFilenameForLoad(pUID);
|
||||
}
|
||||
std::wstring ConsoleSaveFileSplit::getPlayerDataFilenameForSave(
|
||||
const PlayerUID& pUID) {
|
||||
return header.getPlayerDataFilenameForSave(pUID);
|
||||
}
|
||||
std::vector<FileEntry*>* ConsoleSaveFileSplit::getValidPlayerDatFiles() {
|
||||
return header.getValidPlayerDatFiles();
|
||||
}
|
||||
#endif
|
||||
|
||||
int ConsoleSaveFileSplit::getSaveVersion() { return header.getSaveVersion(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ private:
|
|||
// HANDLE hHeap;
|
||||
static void* pvHeap;
|
||||
static unsigned int pagesCommitted;
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
static const unsigned int CSF_PAGE_SIZE = 64 * 1024;
|
||||
static const unsigned int MAX_PAGE_COUNT =
|
||||
32 * 1024; // 2GB virtual allocation
|
||||
|
|
@ -132,7 +132,7 @@ public:
|
|||
|
||||
virtual void Flush(bool autosave, bool updateThumbnail = true);
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
virtual void DebugFlushToFile(void* compressedData = NULL,
|
||||
unsigned int compressedDataSize = 0);
|
||||
#endif
|
||||
|
|
@ -145,11 +145,6 @@ public:
|
|||
virtual std::vector<FileEntry*>* getRegionFilesByDimension(
|
||||
unsigned int dimensionIndex);
|
||||
|
||||
#if 0 || 0
|
||||
virtual std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID);
|
||||
virtual std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID);
|
||||
virtual std::vector<FileEntry*>* getValidPlayerDatFiles();
|
||||
#endif //0
|
||||
|
||||
virtual int getSaveVersion();
|
||||
virtual int getOriginalSaveVersion();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void FileHeader::RemoveFile(FileEntry* file) {
|
|||
fileTable.erase(it);
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"Removed file %ls\n", file->data.filename);
|
||||
#endif
|
||||
|
||||
|
|
@ -76,40 +76,23 @@ void FileHeader::WriteHeader(void* saveMem) {
|
|||
// Write the offset of the header
|
||||
// assert(numberOfBytesWritten == 4);
|
||||
int* begin = (int*)saveMem;
|
||||
#if 0
|
||||
VirtualCopyTo(begin, &headerOffset, sizeof(headerOffset));
|
||||
#else
|
||||
*begin = headerOffset;
|
||||
#endif
|
||||
|
||||
// Write the size of the header
|
||||
// assert(numberOfBytesWritten == 4);
|
||||
#if 0
|
||||
VirtualCopyTo(begin + 1, &headerSize, sizeof(headerSize));
|
||||
#else
|
||||
*(begin + 1) = headerSize;
|
||||
#endif
|
||||
|
||||
short* versions = (short*)(begin + 2);
|
||||
// Write the original version number
|
||||
#if 0
|
||||
VirtualCopyTo(versions, &m_originalSaveVersion,
|
||||
sizeof(m_originalSaveVersion));
|
||||
#else
|
||||
*versions = m_originalSaveVersion;
|
||||
#endif
|
||||
|
||||
// Write the version number
|
||||
short versionNumber = SAVE_FILE_VERSION_NUMBER;
|
||||
// assert(numberOfBytesWritten == 4);
|
||||
//*(begin + 2) = versionNumber;
|
||||
#if 0
|
||||
VirtualCopyTo(versions + 1, &versionNumber, sizeof(versionNumber));
|
||||
#else
|
||||
*(versions + 1) = versionNumber;
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG_FILE_HEADER
|
||||
#if defined(_DEBUG_FILE_HEADER)
|
||||
app.DebugPrintf(
|
||||
"Write save file with original version: %d, and current version %d\n",
|
||||
m_originalSaveVersion, versionNumber);
|
||||
|
|
@ -117,7 +100,7 @@ void FileHeader::WriteHeader(void* saveMem) {
|
|||
|
||||
char* headerPosition = (char*)saveMem + headerOffset;
|
||||
|
||||
#ifdef _DEBUG_FILE_HEADER
|
||||
#if defined(_DEBUG_FILE_HEADER)
|
||||
app.DebugPrintf("\n\nWrite file Header: Offset = %d, Size = %d\n",
|
||||
headerOffset, headerSize);
|
||||
#endif
|
||||
|
|
@ -128,13 +111,8 @@ void FileHeader::WriteHeader(void* saveMem) {
|
|||
// fileTable[i]->data.filename, fileTable[i]->data.startOffset,
|
||||
// fileTable[i]->data.length, fileTable[i]->data.startOffset +
|
||||
// fileTable[i]->data.length);
|
||||
#if 0
|
||||
VirtualCopyTo((void*)headerPosition, &fileTable[i]->data,
|
||||
sizeof(FileEntrySaveData));
|
||||
#else
|
||||
memcpy((void*)headerPosition, &fileTable[i]->data,
|
||||
sizeof(FileEntrySaveData));
|
||||
#endif
|
||||
// assert(numberOfBytesWritten == sizeof(FileEntrySaveData));
|
||||
headerPosition += sizeof(FileEntrySaveData);
|
||||
}
|
||||
|
|
@ -168,42 +146,25 @@ void FileHeader::ReadHeader(
|
|||
// Read the offset of the header
|
||||
// assert(numberOfBytesRead == 4);
|
||||
int* begin = (int*)saveMem;
|
||||
#if 0
|
||||
VirtualCopyFrom(&headerOffset, begin, sizeof(headerOffset));
|
||||
#else
|
||||
headerOffset = *begin;
|
||||
#endif
|
||||
if (isSaveEndianDifferent()) System::ReverseULONG(&headerOffset);
|
||||
|
||||
// Read the size of the header
|
||||
// assert(numberOfBytesRead == 4);
|
||||
#if 0
|
||||
VirtualCopyFrom(&headerSize, begin + 1, sizeof(headerSize));
|
||||
#else
|
||||
headerSize = *(begin + 1);
|
||||
#endif
|
||||
if (isSaveEndianDifferent()) System::ReverseULONG(&headerSize);
|
||||
|
||||
short* versions = (short*)(begin + 2);
|
||||
// Read the original save version number
|
||||
#if 0
|
||||
VirtualCopyFrom(&m_originalSaveVersion, versions,
|
||||
sizeof(m_originalSaveVersion));
|
||||
#else
|
||||
m_originalSaveVersion = *(versions);
|
||||
#endif
|
||||
if (isSaveEndianDifferent()) System::ReverseSHORT(&m_originalSaveVersion);
|
||||
|
||||
// Read the save version number
|
||||
// m_saveVersion = *(begin + 2);
|
||||
#if 0
|
||||
VirtualCopyFrom(&m_saveVersion, versions + 1, sizeof(m_saveVersion));
|
||||
#else
|
||||
m_saveVersion = *(versions + 1);
|
||||
#endif
|
||||
if (isSaveEndianDifferent()) System::ReverseSHORT(&m_saveVersion);
|
||||
|
||||
#ifdef _DEBUG_FILE_HEADER
|
||||
#if defined(_DEBUG_FILE_HEADER)
|
||||
app.DebugPrintf(
|
||||
"Read save file with orignal version: %d, and current version %d\n",
|
||||
m_originalSaveVersion, m_saveVersion);
|
||||
|
|
@ -244,13 +205,8 @@ void FileHeader::ReadHeader(
|
|||
FileEntry* entry = new FileEntry();
|
||||
// assert(numberOfBytesRead == sizeof(FileEntrySaveData));
|
||||
|
||||
#if 0
|
||||
VirtualCopyFrom(&entry->data, fesdHeaderPosition,
|
||||
sizeof(FileEntrySaveData));
|
||||
#else
|
||||
memcpy(&entry->data, fesdHeaderPosition,
|
||||
sizeof(FileEntrySaveData));
|
||||
#endif
|
||||
|
||||
if (isSaveEndianDifferent()) {
|
||||
// Reverse bytes
|
||||
|
|
@ -263,7 +219,7 @@ void FileHeader::ReadHeader(
|
|||
entry->currentFilePointer = entry->data.startOffset;
|
||||
lastFile = entry;
|
||||
fileTable.push_back(entry);
|
||||
#ifdef _DEBUG_FILE_HEADER
|
||||
#if defined(_DEBUG_FILE_HEADER)
|
||||
app.DebugPrintf(
|
||||
"File: %ls, Start = %d, Length = %d, End = %d, Timestamp = "
|
||||
"%lld\n",
|
||||
|
|
@ -289,18 +245,13 @@ void FileHeader::ReadHeader(
|
|||
FileEntry* entry = new FileEntry();
|
||||
// assert(numberOfBytesRead == sizeof(FileEntrySaveData));
|
||||
|
||||
#if 0
|
||||
VirtualCopyFrom(&entry->data, headerPosition,
|
||||
sizeof(FileEntrySaveDataV1));
|
||||
#else
|
||||
memcpy(&entry->data, headerPosition,
|
||||
sizeof(FileEntrySaveDataV1));
|
||||
#endif
|
||||
|
||||
entry->currentFilePointer = entry->data.startOffset;
|
||||
lastFile = entry;
|
||||
fileTable.push_back(entry);
|
||||
#ifdef _DEBUG_FILE_HEADER
|
||||
#if defined(_DEBUG_FILE_HEADER)
|
||||
app.DebugPrintf(
|
||||
"File: %ls, Start = %d, Length = %d, End = %d\n",
|
||||
entry->data.filename, entry->data.startOffset,
|
||||
|
|
@ -313,7 +264,7 @@ void FileHeader::ReadHeader(
|
|||
}
|
||||
} break;
|
||||
default:
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
app.DebugPrintf("********** Invalid save version %d\n",
|
||||
m_saveVersion);
|
||||
__debugbreak();
|
||||
|
|
@ -387,241 +338,6 @@ std::vector<FileEntry*>* FileHeader::getFilesWithPrefix(
|
|||
return files;
|
||||
}
|
||||
|
||||
#if 0 || 0 || 0
|
||||
|
||||
static bool isHexChar(wchar_t wc) {
|
||||
if (wc >= L'0' && wc <= L'9') return true;
|
||||
if (wc >= L'a' && wc <= L'f') return true;
|
||||
return false;
|
||||
}
|
||||
static bool isHexString(wchar_t* ws, int size) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (!isHexChar(ws[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool isDecimalChar(wchar_t wc) {
|
||||
if (wc >= L'0' && wc <= L'9') return true;
|
||||
return false;
|
||||
}
|
||||
static bool isDecimalString(wchar_t* ws, int size) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (!isDecimalChar(ws[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static wchar_t* findFilenameStart(wchar_t* str) {
|
||||
// find the last forward slash in the filename, and return the pointer to
|
||||
// the following character
|
||||
wchar_t* filenameStart = str;
|
||||
int len = wcslen(str);
|
||||
for (int i = 0; i < len; i++)
|
||||
if (str[i] == L'/') filenameStart = &str[i + 1];
|
||||
return filenameStart;
|
||||
}
|
||||
|
||||
std::wstring FileHeader::getPlayerDataFilenameForLoad(const PlayerUID& pUID) {
|
||||
std::wstring retVal = L"";
|
||||
std::vector<FileEntry*>* pFiles = getDatFilesWithOnlineID(pUID);
|
||||
if (!pFiles) {
|
||||
// we didn't find a matching online dat file, so look for an offline
|
||||
// version
|
||||
pFiles = getDatFilesWithMacAndUserID(pUID);
|
||||
}
|
||||
if (!pFiles) {
|
||||
// and we didn't find an offline file, so check if we're the primary
|
||||
// user, and grab the primary file if we are
|
||||
if (pUID.isPrimaryUser()) {
|
||||
pFiles = getDatFilesWithPrimaryUser();
|
||||
}
|
||||
}
|
||||
if (pFiles) {
|
||||
// we've got something to load
|
||||
// assert(pFiles->size() == 1);
|
||||
retVal = pFiles->at(0)->data.filename;
|
||||
delete pFiles;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
std::wstring FileHeader::getPlayerDataFilenameForSave(const PlayerUID& pUID) {
|
||||
// check if we're online first
|
||||
if (pUID.isSignedIntoPSN() == false) {
|
||||
// OK, we're not online, see if we can find another data file with
|
||||
// matching mac and userID
|
||||
std::vector<FileEntry*>* pFiles = getDatFilesWithMacAndUserID(pUID);
|
||||
if (pFiles) {
|
||||
// we've found a previous save, use the filename from it, as it
|
||||
// might have the online part too
|
||||
// assert(pFiles->size() == 1);
|
||||
std::wstring retVal = pFiles->at(0)->data.filename;
|
||||
delete pFiles;
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
// we're either online, or we can't find a previous save, so use the
|
||||
// standard filename
|
||||
std::wstring retVal = pUID.toString() + L".dat";
|
||||
return retVal;
|
||||
}
|
||||
|
||||
std::vector<FileEntry*>* FileHeader::getValidPlayerDatFiles() {
|
||||
std::vector<FileEntry*>* files = NULL;
|
||||
|
||||
// find filenames that match this pattern
|
||||
// P_5e7ff8372ea9_00000004_Mark_4J
|
||||
|
||||
for (unsigned int i = 0; i < fileTable.size(); ++i) {
|
||||
wchar_t* filenameOnly = findFilenameStart(fileTable[i]->data.filename);
|
||||
|
||||
int nameLen = wcslen(filenameOnly);
|
||||
if (nameLen <= 4) continue;
|
||||
|
||||
// make sure it's a ".dat" file
|
||||
if (wcsncmp(&filenameOnly[nameLen - 4], L".dat", 4) != 0) continue;
|
||||
// make sure we start with "P_" or "N_"
|
||||
if ((wcsncmp(&filenameOnly[0], L"P_", 2) != 0) &&
|
||||
(wcsncmp(&filenameOnly[0], L"N_", 2) != 0))
|
||||
continue;
|
||||
// check the next 12 chars are hex
|
||||
if (!isHexString(&filenameOnly[2], 12)) continue;
|
||||
// make sure character 14 is '_'
|
||||
if (filenameOnly[14] != L'_') continue;
|
||||
// check the next 8 chars are decimal
|
||||
if (!isDecimalString(&filenameOnly[15], 8)) continue;
|
||||
|
||||
// if we get here, it must be a valid filename
|
||||
if (files == NULL) {
|
||||
files = new std::vector<FileEntry*>();
|
||||
}
|
||||
files->push_back(fileTable[i]);
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
std::vector<FileEntry*>* FileHeader::getDatFilesWithOnlineID(
|
||||
const PlayerUID& pUID) {
|
||||
if (pUID.isSignedIntoPSN() == false) return NULL;
|
||||
|
||||
std::vector<FileEntry*>* datFiles = getValidPlayerDatFiles();
|
||||
if (datFiles == NULL) return NULL;
|
||||
|
||||
// we're looking for the online name from the pUID in these types of
|
||||
// filenames - P_5e7ff8372ea9_00000004_Mark_4J
|
||||
wchar_t onlineIDW[64];
|
||||
mbstowcs(onlineIDW, pUID.getOnlineID(), 64);
|
||||
|
||||
std::vector<FileEntry*>* files = NULL;
|
||||
int onlineIDSize = wcslen(onlineIDW);
|
||||
if (onlineIDSize == 0) return NULL;
|
||||
|
||||
wcscat(onlineIDW, L".dat");
|
||||
|
||||
#if 0
|
||||
onlineIDSize = wcslen(onlineIDW);
|
||||
#else
|
||||
static const int onlineIDStart = 24; // 24 characters into the filename
|
||||
#endif
|
||||
|
||||
char tempStr[128];
|
||||
for (unsigned int i = 0; i < datFiles->size(); ++i) {
|
||||
wchar_t* filenameOnly =
|
||||
findFilenameStart(datFiles->at(i)->data.filename);
|
||||
wcstombs(tempStr, filenameOnly, 128);
|
||||
app.DebugPrintf("file : %s\n", tempStr);
|
||||
|
||||
#if 0
|
||||
int onlineIDStart = wcslen(filenameOnly) - onlineIDSize;
|
||||
if (onlineIDStart > 0)
|
||||
#else
|
||||
if (wcslen(filenameOnly) > onlineIDStart)
|
||||
#endif
|
||||
{
|
||||
if (wcsncmp(&filenameOnly[onlineIDStart], onlineIDW,
|
||||
onlineIDSize) == 0) {
|
||||
if (files == NULL) {
|
||||
files = new std::vector<FileEntry*>();
|
||||
}
|
||||
files->push_back(datFiles->at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
delete datFiles;
|
||||
|
||||
if (files) sort(files->begin(), files->end(), FileEntry::newestFirst);
|
||||
return files;
|
||||
}
|
||||
|
||||
std::vector<FileEntry*>* FileHeader::getDatFilesWithMacAndUserID(
|
||||
const PlayerUID& pUID) {
|
||||
std::vector<FileEntry*>* datFiles = getValidPlayerDatFiles();
|
||||
if (datFiles == NULL) return NULL;
|
||||
|
||||
// we're looking for the mac address and userIDfrom the pUID in these types
|
||||
// of filenames - P_5e7ff8372ea9_00000004_Mark_4J
|
||||
std::wstring macStr = pUID.macAddressStr();
|
||||
std::wstring userStr = pUID.userIDStr();
|
||||
const wchar_t* pMacStr = macStr.c_str();
|
||||
const wchar_t* pUserStr = userStr.c_str();
|
||||
|
||||
std::vector<FileEntry*>* files = NULL;
|
||||
static const int macAddrStart = 2; // 2 characters into the filename
|
||||
static const int userIDStart = 15; // 15 characters into the filename
|
||||
|
||||
char tempStr[128];
|
||||
for (unsigned int i = 0; i < datFiles->size(); ++i) {
|
||||
wchar_t* filenameOnly =
|
||||
findFilenameStart(datFiles->at(i)->data.filename);
|
||||
wcstombs(tempStr, filenameOnly, 128);
|
||||
app.DebugPrintf("file : %s\n", tempStr);
|
||||
|
||||
// check the mac address matches
|
||||
if (wcsncmp(&filenameOnly[macAddrStart], pMacStr, macStr.size()) == 0) {
|
||||
// check the userID matches
|
||||
if (wcsncmp(&filenameOnly[userIDStart], pUserStr, userStr.size()) ==
|
||||
0) {
|
||||
if (files == NULL) {
|
||||
files = new std::vector<FileEntry*>();
|
||||
}
|
||||
files->push_back(datFiles->at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
delete datFiles;
|
||||
if (files) sort(files->begin(), files->end(), FileEntry::newestFirst);
|
||||
return files;
|
||||
}
|
||||
|
||||
std::vector<FileEntry*>* FileHeader::getDatFilesWithPrimaryUser() {
|
||||
std::vector<FileEntry*>* datFiles = getValidPlayerDatFiles();
|
||||
if (datFiles == NULL) return NULL;
|
||||
|
||||
// we're just looking for filenames starting with "P_" in these types of
|
||||
// filenames - P_5e7ff8372ea9_00000004_Mark_4J
|
||||
std::vector<FileEntry*>* files = NULL;
|
||||
|
||||
char tempStr[128];
|
||||
for (unsigned int i = 0; i < datFiles->size(); ++i) {
|
||||
wchar_t* filenameOnly =
|
||||
findFilenameStart(datFiles->at(i)->data.filename);
|
||||
wcstombs(tempStr, filenameOnly, 128);
|
||||
app.DebugPrintf("file : %s\n", tempStr);
|
||||
|
||||
// check for "P_" prefix
|
||||
if (wcsncmp(&filenameOnly[0], L"P_", 2) == 0) {
|
||||
if (files == NULL) {
|
||||
files = new std::vector<FileEntry*>();
|
||||
}
|
||||
files->push_back(datFiles->at(i));
|
||||
}
|
||||
}
|
||||
delete datFiles;
|
||||
if (files) sort(files->begin(), files->end(), FileEntry::newestFirst);
|
||||
return files;
|
||||
}
|
||||
#endif // 0 || 0
|
||||
|
||||
ByteOrder FileHeader::getEndian(ESavePlatform plat) {
|
||||
ByteOrder platEndian;
|
||||
|
|
|
|||
|
|
@ -58,17 +58,7 @@ enum ESavePlatform {
|
|||
SAVE_FILE_PLATFORM_PSVITA = MAKE_FOURCC('P', 'S', 'V', '_'),
|
||||
SAVE_FILE_PLATFORM_WIN64 = MAKE_FOURCC('W', 'I', 'N', '_'),
|
||||
|
||||
#if 0
|
||||
SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_X360
|
||||
#elif 0
|
||||
SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_XBONE
|
||||
#elif 0
|
||||
SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_PS3
|
||||
#elif 0
|
||||
SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_PS4
|
||||
#elif 0
|
||||
SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_PSVITA
|
||||
#elif defined _WINDOWS64
|
||||
#if defined(_WINDOWS64)
|
||||
SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_WIN64
|
||||
#else
|
||||
// DecalOverdose(HACK + TODO)
|
||||
|
|
@ -161,11 +151,7 @@ private:
|
|||
std::vector<FileEntry*> fileTable;
|
||||
ESavePlatform m_savePlatform;
|
||||
ByteOrder m_saveEndian;
|
||||
#if 0 || 0
|
||||
static const ByteOrder m_localEndian = BIGENDIAN;
|
||||
#else
|
||||
static const ByteOrder m_localEndian = LITTLEENDIAN;
|
||||
#endif
|
||||
|
||||
short m_saveVersion;
|
||||
short m_originalSaveVersion;
|
||||
|
|
@ -197,13 +183,6 @@ protected:
|
|||
|
||||
std::vector<FileEntry*>* getValidPlayerDatFiles();
|
||||
|
||||
#if 0 || 0 || 0
|
||||
std::wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID);
|
||||
std::wstring getPlayerDataFilenameForSave(const PlayerUID& pUID);
|
||||
std::vector<FileEntry*>* getDatFilesWithOnlineID(const PlayerUID& pUID);
|
||||
std::vector<FileEntry*>* getDatFilesWithMacAndUserID(const PlayerUID& pUID);
|
||||
std::vector<FileEntry*>* getDatFilesWithPrimaryUser();
|
||||
#endif
|
||||
|
||||
void setSaveVersion(int version) { m_saveVersion = version; }
|
||||
int getSaveVersion() { return m_saveVersion; }
|
||||
|
|
|
|||
|
|
@ -429,17 +429,3 @@ FloatBuffer* ByteBuffer::asFloatBuffer() {
|
|||
(float*)(buffer + m_position));
|
||||
}
|
||||
|
||||
#if 0
|
||||
// we're using the RSX now to upload textures to vram, so we need th main ram
|
||||
// textures allocated from io space
|
||||
ByteBuffer_IO::ByteBuffer_IO(unsigned int capacity)
|
||||
: ByteBuffer(capacity, (uint8_t*)RenderManager.allocIOMem(capacity, 64)) {
|
||||
memset(buffer, 0, sizeof(uint8_t) * capacity);
|
||||
byteOrder = BIGENDIAN;
|
||||
}
|
||||
|
||||
ByteBuffer_IO::~ByteBuffer_IO() {
|
||||
// delete buffer;
|
||||
RenderManager.freeIOMem(buffer);
|
||||
}
|
||||
#endif // 0
|
||||
|
|
|
|||
|
|
@ -42,13 +42,3 @@ public:
|
|||
FloatBuffer* asFloatBuffer();
|
||||
};
|
||||
|
||||
#if 0
|
||||
// we're using the RSX now to upload textures to vram, so we need th main ram
|
||||
// textures allocated from io space
|
||||
class ByteBuffer_IO : public ByteBuffer {
|
||||
public:
|
||||
ByteBuffer_IO(unsigned int capacity);
|
||||
~ByteBuffer_IO();
|
||||
};
|
||||
|
||||
#endif // 0
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
#include "Compression.h"
|
||||
#if 0 || 0 || 0 || \
|
||||
defined _WIN64 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
// zconf.h defines "typedef unsigned char Byte" which conflicts with the
|
||||
// project's "class Byte" from BasicTypeContainers.h (via stdafx.h).
|
||||
// Rename zlib's Byte to zlib_Byte before the include so the typedef lands
|
||||
|
|
@ -137,7 +136,7 @@ HRESULT Compression::CompressRLE(void* pDestination, unsigned int* pDestSize,
|
|||
*pDestSize = rleSize;
|
||||
memcpy(pDestination, rleCompressBuf, *pDestSize);
|
||||
} else {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -247,18 +246,12 @@ HRESULT Compression::Compress(void* pDestination, unsigned int* pDestSize,
|
|||
void* pSource, unsigned int SrcSize) {
|
||||
// Using zlib for x64 compression - 360 is using native 360 compression and
|
||||
// PS3 a stubbed non-compressing version of this
|
||||
#if 0 || 0 || defined _WIN64 || \
|
||||
0 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
int res = ::compress((Bytef*)pDestination, (uLongf*)&destSize,
|
||||
(Bytef*)pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res == Z_OK) ? S_OK : -1);
|
||||
#elif 0
|
||||
std::uint32_t destSize = (std::uint32_t)(*pDestSize);
|
||||
bool res = EdgeZLib::Compress(pDestination, &destSize, pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res) ? S_OK : -1);
|
||||
#else
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
HRESULT res = XMemCompress(compressionContext, pDestination, &destSize,
|
||||
|
|
@ -281,18 +274,12 @@ HRESULT Compression::Decompress(void* pDestination, unsigned int* pDestSize,
|
|||
|
||||
// Using zlib for x64 compression - 360 is using native 360 compression and
|
||||
// PS3 a stubbed non-compressing version of this
|
||||
#if 0 || 0 || defined _WIN64 || \
|
||||
0 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
int res = ::uncompress((Bytef*)pDestination, (uLongf*)&destSize,
|
||||
(Bytef*)pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res == Z_OK) ? S_OK : -1);
|
||||
#elif 0
|
||||
std::uint32_t destSize = (std::uint32_t)(*pDestSize);
|
||||
bool res = EdgeZLib::Decompress(pDestination, &destSize, pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res) ? S_OK : -1);
|
||||
#else
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
HRESULT res = XMemDecompress(decompressionContext, pDestination,
|
||||
|
|
@ -304,7 +291,6 @@ HRESULT Compression::Decompress(void* pDestination, unsigned int* pDestSize,
|
|||
|
||||
// MGH - same as VirtualDecompress in PSVitaStubs, but for use on other
|
||||
// platforms (so no virtual mem stuff)
|
||||
#if 1
|
||||
void Compression::VitaVirtualDecompress(
|
||||
void* pDestination, unsigned int* pDestSize, void* pSource,
|
||||
unsigned int SrcSize) // (LPVOID buf, SIZE_T dwSize, LPVOID dst)
|
||||
|
|
@ -334,7 +320,6 @@ void Compression::VitaVirtualDecompress(
|
|||
}
|
||||
*pDestSize = Offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT Compression::DecompressWithType(void* pDestination,
|
||||
unsigned int* pDestSize, void* pSource,
|
||||
|
|
@ -347,7 +332,7 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
|||
*pDestSize = SrcSize;
|
||||
return S_OK;
|
||||
case eCompressionType_LZXRLE: {
|
||||
#if (0 || 0 || defined _WIN64)
|
||||
#if defined(_WIN64)
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
HRESULT res = XMemDecompress(decompressionContext, pDestination,
|
||||
(SIZE_T*)&destSize, pSource, SrcSize);
|
||||
|
|
@ -358,8 +343,7 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
|||
#endif
|
||||
} break;
|
||||
case eCompressionType_ZLIBRLE:
|
||||
#if (0 || 0 || 0 || \
|
||||
defined _WIN64 || defined __linux__)
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
if (pDestination != NULL)
|
||||
return ::uncompress(
|
||||
(Bytef*)pDestination, (unsigned long*)pDestSize,
|
||||
|
|
@ -371,8 +355,7 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
|||
break;
|
||||
#endif
|
||||
case eCompressionType_PS3ZLIB:
|
||||
#if (0 || 0 || 0 || \
|
||||
defined _WIN64)
|
||||
#if defined(_WIN64)
|
||||
// Note that we're missing the normal zlib header and footer so
|
||||
// we'll use inflate to decompress the payload and skip all the CRC
|
||||
// checking, etc
|
||||
|
|
@ -441,7 +424,6 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
|||
Compression::Compression() {
|
||||
// Using zlib for x64 compression - 360 is using native 360 compression and
|
||||
// PS3 a stubbed non-compressing version of this
|
||||
#if !(0 || 0)
|
||||
// The default parameters for compression context allocated about 6.5MB,
|
||||
// reducing the partition size here from the default 512KB to 128KB brings
|
||||
// this down to about 3MB
|
||||
|
|
@ -454,15 +436,8 @@ Compression::Compression() {
|
|||
&compressionContext);
|
||||
XMemCreateDecompressionContext(XMEMCODEC_LZX, ¶ms, 0,
|
||||
&decompressionContext);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
m_localDecompressType = eCompressionType_LZXRLE;
|
||||
#elif 0
|
||||
m_localDecompressType = eCompressionType_PS3ZLIB;
|
||||
#else
|
||||
m_localDecompressType = eCompressionType_ZLIBRLE;
|
||||
#endif
|
||||
m_decompressType = m_localDecompressType;
|
||||
|
||||
InitializeCriticalSection(&rleCompressLock);
|
||||
|
|
@ -470,11 +445,9 @@ Compression::Compression() {
|
|||
}
|
||||
|
||||
Compression::~Compression() {
|
||||
#if !(0 || 0 || 0)
|
||||
|
||||
XMemDestroyCompressionContext(compressionContext);
|
||||
XMemDestroyDecompressionContext(decompressionContext);
|
||||
#endif
|
||||
DeleteCriticalSection(&rleCompressLock);
|
||||
DeleteCriticalSection(&rleDecompressLock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,9 @@ public:
|
|||
void* pSource, unsigned int SrcSize);
|
||||
HRESULT DecompressRLE(void* pDestination, unsigned int* pDestSize,
|
||||
void* pSource, unsigned int SrcSize);
|
||||
#if 1
|
||||
static void VitaVirtualDecompress(void* pDestination,
|
||||
unsigned int* pDestSize, void* pSource,
|
||||
unsigned int SrcSize);
|
||||
#endif
|
||||
|
||||
void SetDecompressionType(ECompressionTypes type) {
|
||||
m_decompressType = type;
|
||||
|
|
@ -67,11 +65,8 @@ private:
|
|||
HRESULT DecompressWithType(void* pDestination, unsigned int* pDestSize,
|
||||
void* pSource, unsigned int SrcSize);
|
||||
|
||||
#if 0 || 0
|
||||
#else
|
||||
XMEMCOMPRESSION_CONTEXT compressionContext;
|
||||
XMEMDECOMPRESSION_CONTEXT decompressionContext;
|
||||
#endif
|
||||
CRITICAL_SECTION rleCompressLock;
|
||||
CRITICAL_SECTION rleDecompressLock;
|
||||
|
||||
|
|
@ -84,11 +79,8 @@ private:
|
|||
|
||||
// extern Compression gCompression;
|
||||
|
||||
#if 0 || 0 || defined _WIN64 || \
|
||||
0 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
#define APPROPRIATE_COMPRESSION_TYPE Compression::eCompressionType_ZLIBRLE
|
||||
#elif 0
|
||||
#define APPROPRIATE_COMPRESSION_TYPE Compression::eCompressionType_PS3ZLIB
|
||||
#else
|
||||
#define APPROPRIATE_COMPRESSION_TYPE Compression::eCompressionType_LZXRLE
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -590,14 +590,7 @@ int DataInputStream::readUTFChar() {
|
|||
// 4J Added
|
||||
PlayerUID DataInputStream::readPlayerUID() {
|
||||
PlayerUID returnValue;
|
||||
#if 0 || 0 || 0
|
||||
for (int idPos = 0; idPos < sizeof(PlayerUID); idPos++)
|
||||
((char*)&returnValue)[idPos] = readByte();
|
||||
#elif 0
|
||||
returnValue = readUTF();
|
||||
#else
|
||||
returnValue = readLong();
|
||||
#endif // PS3
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,12 +255,5 @@ void DataOutputStream::writeUTF(const std::wstring& str) {
|
|||
|
||||
// 4J Added
|
||||
void DataOutputStream::writePlayerUID(PlayerUID player) {
|
||||
#if 0 || 0 || 0
|
||||
for (int idPos = 0; idPos < sizeof(PlayerUID); idPos++)
|
||||
writeByte(((char*)&player)[idPos]);
|
||||
#elif 0
|
||||
writeUTF(player.toString());
|
||||
#else
|
||||
writeLong(player);
|
||||
#endif // PS3
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,8 @@
|
|||
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
|
||||
#include "../Headers/net.minecraft.world.h"
|
||||
|
||||
#if 0
|
||||
const std::wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {
|
||||
L"clockP0"};
|
||||
#else
|
||||
const std::wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {
|
||||
L"clockP0", L"clockP1", L"clockP2", L"clockP3"};
|
||||
#endif
|
||||
|
||||
ClockItem::ClockItem(int id) : Item(id) { icons = NULL; }
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,8 @@
|
|||
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
|
||||
#include "../Headers/net.minecraft.world.h"
|
||||
|
||||
#if 0
|
||||
const std::wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {
|
||||
L"compassP0"};
|
||||
#else
|
||||
const std::wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {
|
||||
L"compassP0", L"compassP1", L"compassP2", L"compassP3"};
|
||||
#endif
|
||||
|
||||
CompassItem::CompassItem(int id) : Item(id) { icons = NULL; }
|
||||
|
||||
|
|
|
|||
|
|
@ -77,12 +77,6 @@ std::shared_ptr<ItemInstance> FoodItem::use(
|
|||
|
||||
// 4J : WESTY : Other award ... eating cooked pork chop.
|
||||
// 4J-JEV: This is just for an avatar award on the xbox.
|
||||
#if 0
|
||||
if (instance->getItem() == Item::porkChop_cooked) {
|
||||
player->awardStat(GenericStats::eatPorkChop(),
|
||||
GenericStats::param_eatPorkChop());
|
||||
}
|
||||
#endif
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,13 +117,6 @@ unsigned int SkullItem::getDescriptionId(
|
|||
|
||||
std::wstring SkullItem::getHoverName(
|
||||
std::shared_ptr<ItemInstance> itemInstance) {
|
||||
#if 0
|
||||
if (itemInstance->getAuxValue() == SkullTileEntity::TYPE_CHAR && itemInstance->hasTag() && itemInstance->getTag()->contains(L"SkullOwner"))
|
||||
{
|
||||
return I18n.get("item.skull.player.name", itemInstance->getTag()->getString(L"SkullOwner"));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
return Item::getHoverName(itemInstance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ const double CustomLevelSource::SNOW_CUTOFF = 0.5;
|
|||
CustomLevelSource::CustomLevelSource(Level* level, int64_t seed,
|
||||
bool generateStructures)
|
||||
: generateStructures(generateStructures) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
m_XZSize = level->getLevelData()->getXZSize();
|
||||
|
||||
m_heightmapOverride = byteArray((m_XZSize * 16) * (m_XZSize * 16));
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined(_UNICODE)
|
||||
std::wstring path = L"GAME:\\GameRules\\heightmap.bin";
|
||||
|
||||
#else
|
||||
#ifdef _WINDOWS64
|
||||
#if defined(_WINDOWS64)
|
||||
std::string path = "GameRules\\heightmap.bin";
|
||||
#else
|
||||
std::string path = "GAME:\\GameRules\\heightmap.bin";
|
||||
|
|
@ -38,12 +38,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed,
|
|||
DWORD error = GetLastError();
|
||||
assert(false);
|
||||
} else {
|
||||
#if 0
|
||||
__debugbreak(); // TODO
|
||||
DWORD bytesRead, dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead, dwFileSize = GetFileSize(file, NULL);
|
||||
#endif
|
||||
if (dwFileSize > m_heightmapOverride.length) {
|
||||
app.DebugPrintf("Heightmap binary is too large!!\n");
|
||||
__debugbreak();
|
||||
|
|
@ -59,11 +54,11 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed,
|
|||
|
||||
m_waterheightOverride = byteArray((m_XZSize * 16) * (m_XZSize * 16));
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined(_UNICODE)
|
||||
std::wstring waterHeightPath = L"GAME:\\GameRules\\waterheight.bin";
|
||||
|
||||
#else
|
||||
#ifdef _WINDOWS64
|
||||
#if defined(_WINDOWS64)
|
||||
std::string waterHeightPath = "GameRules\\waterheight.bin";
|
||||
#else
|
||||
std::string waterHeightPath = "GAME:\\GameRules\\waterheight.bin";
|
||||
|
|
@ -77,12 +72,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed,
|
|||
memset(m_waterheightOverride.data, level->seaLevel,
|
||||
m_waterheightOverride.length);
|
||||
} else {
|
||||
#if 0
|
||||
__debugbreak(); // TODO
|
||||
DWORD bytesRead, dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead, dwFileSize = GetFileSize(file, NULL);
|
||||
#endif
|
||||
if (dwFileSize > m_waterheightOverride.length) {
|
||||
app.DebugPrintf("waterheight binary is too large!!\n");
|
||||
__debugbreak();
|
||||
|
|
@ -114,7 +104,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed,
|
|||
}
|
||||
|
||||
CustomLevelSource::~CustomLevelSource() {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
delete caveFeature;
|
||||
delete strongholdFeature;
|
||||
delete villageFeature;
|
||||
|
|
@ -127,7 +117,7 @@ CustomLevelSource::~CustomLevelSource() {
|
|||
}
|
||||
|
||||
void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
int xChunks = 16 / CHUNK_WIDTH;
|
||||
int yChunks = Level::maxBuildHeight / CHUNK_HEIGHT;
|
||||
int waterHeight = level->seaLevel;
|
||||
|
|
@ -249,7 +239,7 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) {
|
|||
|
||||
void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks,
|
||||
BiomeArray biomes) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
int waterHeight = level->seaLevel;
|
||||
int xMapStart = xOffs + m_XZSize / 2;
|
||||
int zMapStart = zOffs + m_XZSize / 2;
|
||||
|
|
@ -355,7 +345,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks,
|
|||
}
|
||||
|
||||
LevelChunk* CustomLevelSource::create(int x, int z) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
return getChunk(x, z);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -363,7 +353,7 @@ LevelChunk* CustomLevelSource::create(int x, int z) {
|
|||
}
|
||||
|
||||
LevelChunk* CustomLevelSource::getChunk(int xOffs, int zOffs) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
random->setSeed(xOffs * 341873128712l + zOffs * 132897987541l);
|
||||
|
||||
// 4J - now allocating this with a physical alloc & bypassing general memory
|
||||
|
|
@ -431,7 +421,7 @@ LevelChunk* CustomLevelSource::getChunk(int xOffs, int zOffs) {
|
|||
// right - this isn't a new fault in the 360 version, have checked that java
|
||||
// does the same.
|
||||
void CustomLevelSource::lightChunk(LevelChunk* lc) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
lc->recalcHeightmap();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -439,7 +429,7 @@ void CustomLevelSource::lightChunk(LevelChunk* lc) {
|
|||
bool CustomLevelSource::hasChunk(int x, int y) { return true; }
|
||||
|
||||
void CustomLevelSource::calcWaterDepths(ChunkSource* parent, int xt, int zt) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
int xo = xt * 16;
|
||||
int zo = zt * 16;
|
||||
for (int x = 0; x < 16; x++) {
|
||||
|
|
@ -511,7 +501,7 @@ void CustomLevelSource::calcWaterDepths(ChunkSource* parent, int xt, int zt) {
|
|||
// 4J - changed this to used pprandom rather than random, so that we can run it
|
||||
// concurrently with getChunk
|
||||
void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
HeavyTile::instaFall = true;
|
||||
int xo = xt * 16;
|
||||
int zo = zt * 16;
|
||||
|
|
@ -538,35 +528,6 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
|
|||
}
|
||||
PIXEndNamedEvent();
|
||||
|
||||
#if 0
|
||||
PIXBeginNamedEvent(0,"Lakes");
|
||||
if (!hasVillage && pprandom->nextInt(4) == 0)
|
||||
{
|
||||
int x = xo + pprandom->nextInt(16) + 8;
|
||||
int y = pprandom->nextInt(Level::maxBuildHeight);
|
||||
int z = zo + pprandom->nextInt(16) + 8;
|
||||
|
||||
LakeFeature *calmWater = new LakeFeature(Tile::calmWater_Id);
|
||||
calmWater->place(level, pprandom, x, y, z);
|
||||
delete calmWater;
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
|
||||
PIXBeginNamedEvent(0,"Lava");
|
||||
if (!hasVillage && pprandom->nextInt(8) == 0)
|
||||
{
|
||||
int x = xo + pprandom->nextInt(16) + 8;
|
||||
int y = pprandom->nextInt(pprandom->nextInt(Level::maxBuildHeight - 8) + 8);
|
||||
int z = zo + pprandom->nextInt(16) + 8;
|
||||
if (y < level->seaLevel || pprandom->nextInt(10) == 0)
|
||||
{
|
||||
LakeFeature *calmLava = new LakeFeature(Tile::calmLava_Id);
|
||||
calmLava->place(level, pprandom, x, y, z);
|
||||
delete calmLava;
|
||||
}
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
#endif
|
||||
|
||||
PIXBeginNamedEvent(0, "Monster rooms");
|
||||
for (int i = 0; i < 8; i++) {
|
||||
|
|
@ -627,7 +588,7 @@ std::wstring CustomLevelSource::gatherStats() { return L"CustomLevelSource"; }
|
|||
|
||||
std::vector<Biome::MobSpawnerData*>* CustomLevelSource::getMobsAt(
|
||||
MobCategory* mobCategory, int x, int y, int z) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
Biome* biome = level->getBiome(x, z);
|
||||
if (biome == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -644,7 +605,7 @@ std::vector<Biome::MobSpawnerData*>* CustomLevelSource::getMobsAt(
|
|||
|
||||
TilePos* CustomLevelSource::findNearestMapFeature(
|
||||
Level* level, const std::wstring& featureName, int x, int y, int z) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) {
|
||||
return strongholdFeature->getNearestGeneratedFeature(level, x, y, z);
|
||||
}
|
||||
|
|
@ -655,7 +616,7 @@ TilePos* CustomLevelSource::findNearestMapFeature(
|
|||
void CustomLevelSource::recreateLogicStructuresForChunk(int chunkX,
|
||||
int chunkZ) {
|
||||
if (generateStructures) {
|
||||
#ifdef _OVERRIDE_HEIGHTMAP
|
||||
#if defined(_OVERRIDE_HEIGHTMAP)
|
||||
mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
villageFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray());
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
// getBlockingCached methods to get and set data (3) Call flushCache, which
|
||||
// writes through any dirty values in cache
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
// Packing for cache entries in large worlds is as follows ( 64 bits per entry)
|
||||
// Add the extra x and z data into the top 32 bits, to keep all the masks and
|
||||
// code for everything else the same
|
||||
|
|
@ -182,7 +182,7 @@ void inline Level::setBrightnessCached(lightCache_t* cache, uint64_t* cacheUse,
|
|||
int idx = ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
||||
lightCache_t posbits =
|
||||
((x & 0x3f0) << 6) | ((y & 0x0f0) << 2) | ((z & 0x3f0) >> 4);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
// Add in the higher bits for x and z
|
||||
posbits |= ((((uint64_t)x) & 0x3FFFC00L) << 38) |
|
||||
((((uint64_t)z) & 0x3FFFC00L) << 22);
|
||||
|
|
@ -197,7 +197,7 @@ void inline Level::setBrightnessCached(lightCache_t* cache, uint64_t* cacheUse,
|
|||
// Then we need to flush
|
||||
int val = (cacheValue >> LIGHTING_SHIFT) & 15;
|
||||
int xx = ((cacheValue >> 6) & 0x3f0) | (x & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
xx |= ((cacheValue >> 38) & 0x3FFFC00);
|
||||
xx = (xx << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -205,7 +205,7 @@ void inline Level::setBrightnessCached(lightCache_t* cache, uint64_t* cacheUse,
|
|||
#endif
|
||||
int yy = ((cacheValue >> 2) & 0x0f0) | (y & 15);
|
||||
int zz = ((cacheValue << 4) & 0x3f0) | (z & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
zz |= ((cacheValue >> 22) & 0x3FFFC00);
|
||||
zz = (zz << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -242,7 +242,7 @@ inline int Level::getBrightnessCached(lightCache_t* cache,
|
|||
int idx = ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
||||
lightCache_t posbits =
|
||||
((x & 0x3f0) << 6) | ((y & 0x0f0) << 2) | ((z & 0x3f0) >> 4);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
// Add in the higher bits for x and z
|
||||
posbits |= ((((uint64_t)x) & 0x3FFFC00L) << 38) |
|
||||
((((uint64_t)z) & 0x3FFFC00L) << 22);
|
||||
|
|
@ -256,7 +256,7 @@ inline int Level::getBrightnessCached(lightCache_t* cache,
|
|||
// Then we need to flush
|
||||
int val = (cacheValue >> LIGHTING_SHIFT) & 15;
|
||||
int xx = ((cacheValue >> 6) & 0x3f0) | (x & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
xx |= ((cacheValue >> 38) & 0x3FFFC00);
|
||||
xx = (xx << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -264,7 +264,7 @@ inline int Level::getBrightnessCached(lightCache_t* cache,
|
|||
#endif
|
||||
int yy = ((cacheValue >> 2) & 0x0f0) | (y & 15);
|
||||
int zz = ((cacheValue << 4) & 0x3f0) | (z & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
zz |= ((cacheValue >> 22) & 0x3FFFC00);
|
||||
zz = (zz << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -301,7 +301,7 @@ inline int Level::getEmissionCached(lightCache_t* cache, int ct, int x, int y,
|
|||
int idx = ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
||||
lightCache_t posbits =
|
||||
((x & 0x3f0) << 6) | ((y & 0x0f0) << 2) | ((z & 0x3f0) >> 4);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
// Add in the higher bits for x and z
|
||||
posbits |= ((((uint64_t)x) & 0x3FFFC00) << 38) |
|
||||
((((uint64_t)z) & 0x3FFFC00) << 22);
|
||||
|
|
@ -315,7 +315,7 @@ inline int Level::getEmissionCached(lightCache_t* cache, int ct, int x, int y,
|
|||
// Then we need to flush
|
||||
int val = (cacheValue >> LIGHTING_SHIFT) & 15;
|
||||
int xx = ((cacheValue >> 6) & 0x3f0) | (x & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
xx |= ((cacheValue >> 38) & 0x3FFFC00);
|
||||
xx = (xx << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -323,7 +323,7 @@ inline int Level::getEmissionCached(lightCache_t* cache, int ct, int x, int y,
|
|||
#endif
|
||||
int yy = ((cacheValue >> 2) & 0x0f0) | (y & 15);
|
||||
int zz = ((cacheValue << 4) & 0x3f0) | (z & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
zz |= ((cacheValue >> 22) & 0x3FFFC00);
|
||||
zz = (zz << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -369,7 +369,7 @@ inline int Level::getBlockingCached(lightCache_t* cache,
|
|||
int idx = ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
||||
lightCache_t posbits =
|
||||
((x & 0x3f0) << 6) | ((y & 0x0f0) << 2) | ((z & 0x3f0) >> 4);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
// Add in the higher bits for x and z
|
||||
posbits |= ((((uint64_t)x) & 0x3FFFC00L) << 38) |
|
||||
((((uint64_t)z) & 0x3FFFC00L) << 22);
|
||||
|
|
@ -383,7 +383,7 @@ inline int Level::getBlockingCached(lightCache_t* cache,
|
|||
// Then we need to flush
|
||||
int val = (cacheValue >> LIGHTING_SHIFT) & 15;
|
||||
int xx = ((cacheValue >> 6) & 0x3f0) | (x & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
xx |= ((cacheValue >> 38) & 0x3FFFC00);
|
||||
xx = (xx << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -391,7 +391,7 @@ inline int Level::getBlockingCached(lightCache_t* cache,
|
|||
#endif
|
||||
int yy = ((cacheValue >> 2) & 0x0f0) | (y & 15);
|
||||
int zz = ((cacheValue << 4) & 0x3f0) | (z & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
zz |= ((cacheValue >> 22) & 0x3FFFC00);
|
||||
zz = (zz << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -459,7 +459,7 @@ void Level::flushCache(lightCache_t* cache, uint64_t cacheUse,
|
|||
if (cacheValue & LIGHTING_WRITEBACK) {
|
||||
int val = (cacheValue >> LIGHTING_SHIFT) & 15;
|
||||
int xx = ((cacheValue >> 6) & 0x3f0) | (x & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
xx |= ((cacheValue >> 38) & 0x3FFFC00);
|
||||
xx = (xx << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -467,7 +467,7 @@ void Level::flushCache(lightCache_t* cache, uint64_t cacheUse,
|
|||
#endif
|
||||
int yy = ((cacheValue >> 2) & 0x0f0) | (y & 15);
|
||||
int zz = ((cacheValue << 4) & 0x3f0) | (z & 15);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
zz |= ((cacheValue >> 22) & 0x3FFFC00);
|
||||
zz = (zz << 6) >> 6; // sign extend
|
||||
#else
|
||||
|
|
@ -858,13 +858,13 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data,
|
|||
oldTile = c->getTile(x & 15, y, z & 15);
|
||||
}
|
||||
bool result;
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
int old = c->getTile(x & 15, y, z & 15);
|
||||
int olddata = c->getData(x & 15, y, z & 15);
|
||||
#endif
|
||||
result = c->setTileAndData(x & 15, y, z & 15, tile, data);
|
||||
if (updateFlags != Tile::UPDATE_INVISIBLE_NO_LIGHT) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
PIXBeginNamedEvent(0, "Checking light %d %d %d", x, y, z);
|
||||
PIXBeginNamedEvent(0, "was %d, %d now %d, %d", old, olddata, tile,
|
||||
data);
|
||||
|
|
@ -2138,7 +2138,7 @@ void Level::tickEntities() {
|
|||
}
|
||||
|
||||
if (!e->removed) {
|
||||
#ifndef _FINAL_BUILD
|
||||
#if !defined(_FINAL_BUILD)
|
||||
if (!(app.DebugSettingsOn() && app.GetMobsDontTickEnabled() &&
|
||||
e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER)))
|
||||
#endif
|
||||
|
|
@ -2178,7 +2178,7 @@ void Level::tickEntities() {
|
|||
*it; // tilevector<shared_ptr<Entity> >.at(i);
|
||||
if (!te->isRemoved() && te->hasLevel()) {
|
||||
if (hasChunkAt(te->x, te->y, te->z)) {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
LevelChunk* lc = getChunk(te->x >> 4, te->z >> 4);
|
||||
if (!isClientSide || !lc->isUnloaded())
|
||||
#endif
|
||||
|
|
@ -2272,14 +2272,7 @@ void Level::tick(std::shared_ptr<Entity> e, bool actual) {
|
|||
int xc = Mth::floor(e->x);
|
||||
int zc = Mth::floor(e->z);
|
||||
int r = 32;
|
||||
#if 0
|
||||
// AP - make sure the dragon ticks all the time, even when there aren't any
|
||||
// chunks.
|
||||
if (actual && e->GetType() != eTYPE_ENDERDRAGON &&
|
||||
!hasChunksAt(xc - r, 0, zc - r, xc + r, 0, zc + r))
|
||||
#else
|
||||
if (actual && !hasChunksAt(xc - r, 0, zc - r, xc + r, 0, zc + r))
|
||||
#endif
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -2290,13 +2283,7 @@ void Level::tick(std::shared_ptr<Entity> e, bool actual) {
|
|||
e->yRotO = e->yRot;
|
||||
e->xRotO = e->xRot;
|
||||
|
||||
#if 0
|
||||
// AP - make sure the dragon ticks all the time, even when there aren't any
|
||||
// chunks.
|
||||
if (actual && (e->GetType() == eTYPE_ENDERDRAGON || e->inChunk))
|
||||
#else
|
||||
if (actual && e->inChunk)
|
||||
#endif
|
||||
{
|
||||
e->tickCount++;
|
||||
if (e->riding != NULL) {
|
||||
|
|
@ -2851,7 +2838,7 @@ void Level::prepareWeather() {
|
|||
void Level::tickWeather() {
|
||||
if (dimension->hasCeiling) return;
|
||||
|
||||
#ifndef _FINAL_BUILD
|
||||
#if !defined(_FINAL_BUILD)
|
||||
// debug setting added to disable weather
|
||||
if (app.DebugSettingsOn()) {
|
||||
if (app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
|
|
@ -2929,22 +2916,6 @@ void Level::toggleDownfall() {
|
|||
}
|
||||
|
||||
void Level::buildAndPrepareChunksToPoll() {
|
||||
#if 0
|
||||
AUTO_VAR(itEnd, players.end());
|
||||
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
|
||||
{
|
||||
std::shared_ptr<Player> player = *it;
|
||||
int xx = Mth::floor(player->x / 16);
|
||||
int zz = Mth::floor(player->z / 16);
|
||||
|
||||
int r = CHUNK_POLL_RANGE;
|
||||
for (int x = -r; x <= r; x++)
|
||||
for (int z = -r; z <= r; z++)
|
||||
{
|
||||
chunksToPoll.insert(ChunkPos(x + xx, z + zz));
|
||||
}
|
||||
}
|
||||
#else
|
||||
// 4J - rewritten to add chunks interleaved by player, and to add them from
|
||||
// the centre outwards. We're going to be potentially adding less creatures
|
||||
// than the original so that our count stays consistent with number of
|
||||
|
|
@ -2972,7 +2943,6 @@ void Level::buildAndPrepareChunksToPoll() {
|
|||
}
|
||||
delete[] xx;
|
||||
delete[] zz;
|
||||
#endif
|
||||
|
||||
if (delayUntilNextMoodSound > 0) delayUntilNextMoodSound--;
|
||||
|
||||
|
|
@ -3012,15 +2982,9 @@ void Level::tickClientSideTiles(int xo, int zo, LevelChunk* lc) {
|
|||
player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) {
|
||||
// 4J-PB - Fixed issue with cave audio event having 2 sounds at
|
||||
// 192k
|
||||
#if 0
|
||||
this->playSound(x + 0.5, y + 0.5, z + 0.5,
|
||||
eSoundType_AMBIENT_CAVE_CAVE2, 0.7f,
|
||||
0.8f + random->nextFloat() * 0.2f);
|
||||
#else
|
||||
this->playSound(x + 0.5, y + 0.5, z + 0.5,
|
||||
eSoundType_AMBIENT_CAVE_CAVE, 0.7f,
|
||||
0.8f + random->nextFloat() * 0.2f);
|
||||
#endif
|
||||
delayUntilNextMoodSound =
|
||||
random->nextInt(SharedConstants::TICKS_PER_SECOND * 60 *
|
||||
10) +
|
||||
|
|
@ -3147,18 +3111,6 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc,
|
|||
if (!hasChunksAt(xc, yc, zc, 17)) return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Get the frequency of the timer
|
||||
LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime1, qwDeltaTime2;
|
||||
float fElapsedTime1 = 0.0f;
|
||||
float fElapsedTime2 = 0.0f;
|
||||
QueryPerformanceFrequency( &qwTicksPerSec );
|
||||
float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart;
|
||||
|
||||
QueryPerformanceCounter( &qwTime );
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
|
||||
EnterCriticalSection(&m_checkLightCS);
|
||||
|
||||
|
|
@ -3386,28 +3338,8 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc,
|
|||
}
|
||||
}
|
||||
// if( cache ) XUnlockL2(XLOCKL2_INDEX_TITLE);
|
||||
#if 0
|
||||
QueryPerformanceCounter( &qwNewTime );
|
||||
qwDeltaTime1.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart;
|
||||
qwTime = qwNewTime;
|
||||
#endif
|
||||
|
||||
flushCache(cache, cacheUse, layer);
|
||||
#if 0
|
||||
/////////////////////////////////////////////////////////////////
|
||||
if( cache )
|
||||
{
|
||||
QueryPerformanceCounter( &qwNewTime );
|
||||
qwDeltaTime2.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart;
|
||||
fElapsedTime1 = fSecsPerTick * static_cast<float>(qwDeltaTime1.QuadPart);
|
||||
fElapsedTime2 = fSecsPerTick * static_cast<float>(qwDeltaTime2.QuadPart);
|
||||
if( ( darktcc > 0 ) | ( tcc > 0 ) )
|
||||
{
|
||||
printf("%d %d %d %f + %f = %f\n", darktcc, tcc, darktcc + tcc, fElapsedTime1 * 1000.0f, fElapsedTime2 * 1000.0f, ( fElapsedTime1 + fElapsedTime2 ) * 1000.0f);
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
LeaveCriticalSection(&m_checkLightCS);
|
||||
}
|
||||
|
||||
|
|
@ -3432,15 +3364,6 @@ std::vector<std::shared_ptr<Entity> >* Level::getEntities(
|
|||
int zc0 = Mth::floor((bb->z0 - 2) / 16);
|
||||
int zc1 = Mth::floor((bb->z1 + 2) / 16);
|
||||
|
||||
#if 0
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
// AP - RW critical sections are expensive so enter it here so we only have
|
||||
// to call it once instead of X times
|
||||
EnterCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
EnterCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int xc = xc0; xc <= xc1; xc++)
|
||||
for (int zc = zc0; zc <= zc1; zc++) {
|
||||
|
|
@ -3450,13 +3373,6 @@ std::vector<std::shared_ptr<Entity> >* Level::getEntities(
|
|||
}
|
||||
MemSect(0);
|
||||
|
||||
#if 0
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
LeaveCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
LeaveCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return &es;
|
||||
}
|
||||
|
|
@ -3475,15 +3391,6 @@ std::vector<std::shared_ptr<Entity> >* Level::getEntitiesOfClass(
|
|||
std::vector<std::shared_ptr<Entity> >* es =
|
||||
new std::vector<std::shared_ptr<Entity> >();
|
||||
|
||||
#if 0
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
// AP - RW critical sections are expensive so enter it here so we only have
|
||||
// to call it once instead of X times
|
||||
EnterCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
EnterCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int xc = xc0; xc <= xc1; xc++) {
|
||||
for (int zc = zc0; zc <= zc1; zc++) {
|
||||
|
|
@ -3494,13 +3401,6 @@ std::vector<std::shared_ptr<Entity> >* Level::getEntitiesOfClass(
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
LeaveCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
LeaveCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return es;
|
||||
}
|
||||
|
|
@ -3538,22 +3438,6 @@ void Level::tileEntityChanged(int x, int y, int z,
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
unsigned int Level::countInstanceOf(BaseObject::Class *clas)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
EnterCriticalSection(&m_entitiesCS);
|
||||
AUTO_VAR(itEnd, entities.end());
|
||||
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
|
||||
{
|
||||
std::shared_ptr<Entity> e = *it;//entities.at(i);
|
||||
if (clas->isAssignableFrom(e->getClass())) count++;
|
||||
}
|
||||
LeaveCriticalSection(&m_entitiesCS);
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 4J - added - more limited (but faster) version of above, used to count water
|
||||
// animals, animals, monsters for the mob spawner singleType flag should be true
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class GameRules;
|
|||
|
||||
class Level : public LevelSource {
|
||||
public:
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
using lightCache_t = uint64_t;
|
||||
#else
|
||||
using lightCache_t = unsigned int;
|
||||
|
|
@ -289,7 +289,7 @@ public:
|
|||
static const int LIGHTING_SHIFT = 24;
|
||||
static const int BLOCKING_SHIFT = 20;
|
||||
static const int EMISSION_SHIFT = 16;
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
static const int64_t LIGHTING_WRITEBACK = 0x80000000LL;
|
||||
static const int64_t EMISSION_VALID = 0x40000000LL;
|
||||
static const int64_t BLOCKING_VALID = 0x20000000LL;
|
||||
|
|
@ -447,12 +447,7 @@ public:
|
|||
void toggleDownfall();
|
||||
|
||||
protected:
|
||||
#if 0
|
||||
// AP - See CustomSet.h for an explanation of this
|
||||
CustomSet chunksToPoll;
|
||||
#else
|
||||
std::unordered_set<ChunkPos, ChunkPosKeyHash, ChunkPosKeyEq> chunksToPoll;
|
||||
#endif
|
||||
|
||||
private:
|
||||
int delayUntilNextMoodSound;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
#include "../Entities/ItemEntity.h"
|
||||
#include "../Entities/Mobs/Minecart.h"
|
||||
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
CRITICAL_SECTION LevelChunk::m_csSharing;
|
||||
#endif
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
// AP - use a RW critical section so we can have multiple threads reading the
|
||||
// same data to avoid a clash
|
||||
CRITICAL_RW_SECTION LevelChunk::m_csEntities;
|
||||
|
|
@ -33,10 +33,10 @@ CRITICAL_SECTION LevelChunk::m_csTileEntities;
|
|||
bool LevelChunk::touchedSky = false;
|
||||
|
||||
void LevelChunk::staticCtor() {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
InitializeCriticalSection(&m_csSharing);
|
||||
#endif
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
InitializeCriticalRWSection(&m_csEntities);
|
||||
#else
|
||||
InitializeCriticalSection(&m_csEntities);
|
||||
|
|
@ -49,14 +49,14 @@ void LevelChunk::init(Level* level, int x, int z) {
|
|||
for (int i = 0; i < 16 * 16; i++) {
|
||||
biomes[i] = 0xff;
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
entityBlocks =
|
||||
new std::vector<std::shared_ptr<Entity> >*[ENTITY_BLOCKS_LENGTH];
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -80,7 +80,7 @@ void LevelChunk::init(Level* level, int x, int z) {
|
|||
this->z = z;
|
||||
MemSect(1);
|
||||
heightmap = byteArray(16 * 16);
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
|
|
@ -88,7 +88,7 @@ void LevelChunk::init(Level* level, int x, int z) {
|
|||
for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++) {
|
||||
entityBlocks[i] = new std::vector<std::shared_ptr<Entity> >();
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -117,7 +117,7 @@ void LevelChunk::init(Level* level, int x, int z) {
|
|||
// the the initialisation block array.
|
||||
emissiveAdded = true;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
m_bUnloaded = false; // 4J Added
|
||||
m_unloadedEntitiesTag = NULL;
|
||||
#endif
|
||||
|
|
@ -147,7 +147,7 @@ LevelChunk::LevelChunk(Level* level, int x, int z)
|
|||
upperBlockLight = NULL;
|
||||
}
|
||||
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
sharingTilesAndData = false;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ LevelChunk::LevelChunk(Level* level, byteArray blocks, int x, int z)
|
|||
}
|
||||
|
||||
serverTerrainPopulated = NULL;
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
sharingTilesAndData = false;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ LevelChunk::LevelChunk(Level* level, int x, int z, LevelChunk* lc)
|
|||
// 4J Stu - Copy over the biome data
|
||||
memcpy(biomes.data, lc->biomes.data, biomes.length);
|
||||
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
lowerBlocks = lc->lowerBlocks;
|
||||
lowerData = lc->lowerData;
|
||||
lowerSkyLight = new SparseLightStorage(lc->lowerSkyLight);
|
||||
|
|
@ -240,7 +240,7 @@ LevelChunk::LevelChunk(Level* level, int x, int z, LevelChunk* lc)
|
|||
|
||||
// 4J Added so we can track unsaved chunks better
|
||||
void LevelChunk::setUnsaved(bool unsaved) {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
if (m_unsaved != unsaved) {
|
||||
if (unsaved)
|
||||
level->incrementUnsavedChunkCount();
|
||||
|
|
@ -252,7 +252,7 @@ void LevelChunk::setUnsaved(bool unsaved) {
|
|||
}
|
||||
|
||||
void LevelChunk::stopSharingTilesAndData() {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
EnterCriticalSection(&m_csSharing);
|
||||
lastUnsharedTime = System::currentTimeMillis();
|
||||
if (!sharingTilesAndData) {
|
||||
|
|
@ -321,7 +321,7 @@ void LevelChunk::stopSharingTilesAndData() {
|
|||
// the server. So generally like stop sharing, for the case where we're already
|
||||
// not sharing
|
||||
void LevelChunk::reSyncLighting() {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
EnterCriticalSection(&m_csSharing);
|
||||
|
||||
if (isEmpty()) {
|
||||
|
|
@ -329,7 +329,7 @@ void LevelChunk::reSyncLighting() {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
LevelChunk* lc = MinecraftServer::getInstance()
|
||||
->getLevel(level->dimension->id)
|
||||
->cache->getChunkLoadedOrUnloaded(x, z);
|
||||
|
|
@ -359,7 +359,7 @@ void LevelChunk::reSyncLighting() {
|
|||
}
|
||||
|
||||
void LevelChunk::startSharingTilesAndData(int forceMs) {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
EnterCriticalSection(&m_csSharing);
|
||||
if (sharingTilesAndData) {
|
||||
LeaveCriticalSection(&m_csSharing);
|
||||
|
|
@ -375,7 +375,7 @@ void LevelChunk::startSharingTilesAndData(int forceMs) {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
LevelChunk* lc = MinecraftServer::getInstance()
|
||||
->getLevel(level->dimension->id)
|
||||
->cache->getChunkLoadedOrUnloaded(x, z);
|
||||
|
|
@ -434,7 +434,7 @@ void LevelChunk::startSharingTilesAndData(int forceMs) {
|
|||
}
|
||||
|
||||
LevelChunk::~LevelChunk() {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
if (!sharingTilesAndData)
|
||||
#endif
|
||||
{
|
||||
|
|
@ -456,7 +456,7 @@ LevelChunk::~LevelChunk() {
|
|||
|
||||
delete[] biomes.data;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
delete m_unloadedEntitiesTag;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -481,11 +481,6 @@ int LevelChunk::getHighestSectionPosition() {
|
|||
void LevelChunk::recalcBlockLights() {}
|
||||
|
||||
void LevelChunk::recalcHeightmapOnly() {
|
||||
#if 0
|
||||
// AP - lets fetch ALL the chunk data at the same time for a good speed up
|
||||
byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT);
|
||||
getBlockData(blockData);
|
||||
#endif
|
||||
|
||||
int min = Level::maxBuildHeight - 1;
|
||||
for (int x = 0; x < 16; x++)
|
||||
|
|
@ -497,29 +492,6 @@ void LevelChunk::recalcHeightmapOnly() {
|
|||
int y = Level::maxBuildHeight - 1;
|
||||
// int p = x << level->depthBitsPlusFour | z <<
|
||||
// level->depthBits; // 4J - removed
|
||||
#if 0
|
||||
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
||||
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
|
||||
y = 127;
|
||||
while (y > 0 &&
|
||||
Tile::lightBlock[blockData[Index + offset + (y - 1)]] ==
|
||||
0) // 4J - was blocks->get() was blocks[p + y - 1]
|
||||
{
|
||||
y--;
|
||||
}
|
||||
if (y == 0) {
|
||||
offset = 0;
|
||||
y = 127;
|
||||
while (y > 0 &&
|
||||
Tile::lightBlock[blockData[Index + offset + (y - 1)]] ==
|
||||
0) // 4J - was blocks->get() was blocks[p + y - 1]
|
||||
{
|
||||
y--;
|
||||
}
|
||||
} else {
|
||||
y += 128;
|
||||
}
|
||||
#else
|
||||
CompressedTileStorage* blocks =
|
||||
(y - 1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks
|
||||
: lowerBlocks;
|
||||
|
|
@ -538,7 +510,6 @@ void LevelChunk::recalcHeightmapOnly() {
|
|||
? upperBlocks
|
||||
: lowerBlocks;
|
||||
}
|
||||
#endif
|
||||
heightmap[(unsigned)z << 4 | x] = (uint8_t)y;
|
||||
if (y < min) min = y;
|
||||
}
|
||||
|
|
@ -546,17 +517,9 @@ void LevelChunk::recalcHeightmapOnly() {
|
|||
this->minHeight = min;
|
||||
this->setUnsaved(true);
|
||||
|
||||
#if 0
|
||||
delete blockData.data;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LevelChunk::recalcHeightmap() {
|
||||
#if 0
|
||||
// AP - lets fetch ALL the chunk data at the same time for a good speed up
|
||||
byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT);
|
||||
getBlockData(blockData);
|
||||
#endif
|
||||
lowestHeightmap = std::numeric_limits<int>::max();
|
||||
|
||||
int min = Level::maxBuildHeight - 1;
|
||||
|
|
@ -566,29 +529,6 @@ void LevelChunk::recalcHeightmap() {
|
|||
// int p = x << level->depthBitsPlusFour | z <<
|
||||
// level->depthBits; // 4J - removed
|
||||
|
||||
#if 0
|
||||
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
||||
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
|
||||
y = 127;
|
||||
while (y > 0 &&
|
||||
Tile::lightBlock[blockData[Index + offset + (y - 1)]] ==
|
||||
0) // 4J - was blocks->get() was blocks[p + y - 1]
|
||||
{
|
||||
y--;
|
||||
}
|
||||
if (y == 0) {
|
||||
offset = 0;
|
||||
y = 127;
|
||||
while (y > 0 &&
|
||||
Tile::lightBlock[blockData[Index + offset + (y - 1)]] ==
|
||||
0) // 4J - was blocks->get() was blocks[p + y - 1]
|
||||
{
|
||||
y--;
|
||||
}
|
||||
} else {
|
||||
y += 128;
|
||||
}
|
||||
#else
|
||||
CompressedTileStorage* blocks =
|
||||
(y - 1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks
|
||||
: lowerBlocks;
|
||||
|
|
@ -607,7 +547,6 @@ void LevelChunk::recalcHeightmap() {
|
|||
? upperBlocks
|
||||
: lowerBlocks;
|
||||
}
|
||||
#endif
|
||||
heightmap[(unsigned)z << 4 | x] = (uint8_t)y;
|
||||
if (y < min) min = y;
|
||||
if (y < lowestHeightmap) lowestHeightmap = y;
|
||||
|
|
@ -615,37 +554,6 @@ void LevelChunk::recalcHeightmap() {
|
|||
if (!level->dimension->hasCeiling) {
|
||||
int br = Level::MAX_BRIGHTNESS;
|
||||
int yy = Level::maxBuildHeight - 1;
|
||||
#if 0
|
||||
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
|
||||
SparseLightStorage* skyLight = upperSkyLight;
|
||||
yy = 127;
|
||||
do {
|
||||
br -=
|
||||
Tile::lightBlock[blockData[Index + offset +
|
||||
yy]]; // 4J - blocks->get()
|
||||
// was blocks[p + yy]
|
||||
if (br > 0) {
|
||||
skyLight->set(x, yy, z, br);
|
||||
}
|
||||
yy--;
|
||||
} while (yy > 0 && br > 0);
|
||||
|
||||
if (yy == 0 && br > 0) {
|
||||
offset = 0;
|
||||
skyLight = lowerSkyLight;
|
||||
yy = 127;
|
||||
do {
|
||||
br -= Tile::lightBlock
|
||||
[blockData[Index + offset +
|
||||
yy]]; // 4J - blocks->get() was blocks[p
|
||||
// + yy]
|
||||
if (br > 0) {
|
||||
skyLight->set(x, yy, z, br);
|
||||
}
|
||||
yy--;
|
||||
} while (yy > 0 && br > 0);
|
||||
}
|
||||
#else
|
||||
CompressedTileStorage* blocks =
|
||||
yy >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks
|
||||
: lowerBlocks;
|
||||
|
|
@ -672,7 +580,6 @@ void LevelChunk::recalcHeightmap() {
|
|||
? upperSkyLight
|
||||
: lowerSkyLight;
|
||||
} while (yy > 0 && br > 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -685,9 +592,6 @@ void LevelChunk::recalcHeightmap() {
|
|||
|
||||
this->setUnsaved(true);
|
||||
|
||||
#if 0
|
||||
delete blockData.data;
|
||||
#endif
|
||||
}
|
||||
|
||||
// 4J - this code is fully commented out in the java version, but we have
|
||||
|
|
@ -1286,13 +1190,13 @@ void LevelChunk::addEntity(std::shared_ptr<Entity> e) {
|
|||
e->yChunk = yc;
|
||||
e->zChunk = z;
|
||||
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
entityBlocks[yc]->push_back(e);
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -1307,7 +1211,7 @@ void LevelChunk::removeEntity(std::shared_ptr<Entity> e, int yc) {
|
|||
if (yc < 0) yc = 0;
|
||||
if (yc >= ENTITY_BLOCKS_LENGTH) yc = ENTITY_BLOCKS_LENGTH - 1;
|
||||
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
|
|
@ -1320,20 +1224,11 @@ void LevelChunk::removeEntity(std::shared_ptr<Entity> e, int yc) {
|
|||
// 4J - we don't want storage creeping up here as thinkgs move round the
|
||||
// world accumulating up spare space
|
||||
MemSect(31);
|
||||
#if 0
|
||||
// MGH - have to sort this C++11 code
|
||||
static bool bShowMsg = true;
|
||||
if (bShowMsg) {
|
||||
app.DebugPrintf("Need to add C++11 shrink_to_fit for PS3\n");
|
||||
bShowMsg = false;
|
||||
}
|
||||
#else
|
||||
entityBlocks[yc]->shrink_to_fit();
|
||||
#endif
|
||||
MemSect(0);
|
||||
}
|
||||
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -1485,7 +1380,7 @@ void LevelChunk::load() {
|
|||
loaded = true;
|
||||
|
||||
if (!level->isClientSide) {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
if (m_bUnloaded && m_unloadedEntitiesTag) {
|
||||
ListTag<CompoundTag>* entityTags =
|
||||
(ListTag<CompoundTag>*)m_unloadedEntitiesTag->getList(
|
||||
|
|
@ -1530,7 +1425,7 @@ void LevelChunk::load() {
|
|||
LeaveCriticalSection(&m_csTileEntities);
|
||||
level->addAllPendingTileEntities(values);
|
||||
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
|
|
@ -1538,13 +1433,13 @@ void LevelChunk::load() {
|
|||
for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++) {
|
||||
level->addEntities(entityBlocks[i]);
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
m_bUnloaded = false;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1563,7 +1458,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
|
|||
LeaveCriticalSection(&m_csTileEntities);
|
||||
}
|
||||
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
|
|
@ -1571,14 +1466,14 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
|
|||
for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++) {
|
||||
level->removeEntities(entityBlocks[i]);
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
// app.DebugPrintf("Unloaded chunk %d, %d\n", x, z);
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
if (!m_bUnloaded) // 4J-JEV: If we unload a chunk twice, we delete all the
|
||||
// entities/tile-entities its saved in the entitiesTag.
|
||||
{
|
||||
|
|
@ -1636,7 +1531,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
|
|||
}
|
||||
|
||||
bool LevelChunk::containsPlayer() {
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
|
|
@ -1645,7 +1540,7 @@ bool LevelChunk::containsPlayer() {
|
|||
std::vector<std::shared_ptr<Entity> >* vecEntity = entityBlocks[i];
|
||||
for (int j = 0; j < vecEntity->size(); j++) {
|
||||
if (vecEntity->at(j)->GetType() == eTYPE_SERVERPLAYER) {
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -1654,7 +1549,7 @@ bool LevelChunk::containsPlayer() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -1662,7 +1557,7 @@ bool LevelChunk::containsPlayer() {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
bool LevelChunk::isUnloaded() { return m_bUnloaded; }
|
||||
#endif
|
||||
|
||||
|
|
@ -1676,11 +1571,9 @@ void LevelChunk::getEntities(std::shared_ptr<Entity> except, AABB* bb,
|
|||
if (yc0 < 0) yc0 = 0;
|
||||
if (yc1 >= ENTITY_BLOCKS_LENGTH) yc1 = ENTITY_BLOCKS_LENGTH - 1;
|
||||
|
||||
#if 1
|
||||
// AP - RW critical sections are expensive so enter once in
|
||||
// Level::getEntities
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
for (int yc = yc0; yc <= yc1; yc++) {
|
||||
std::vector<std::shared_ptr<Entity> >* entities = entityBlocks[yc];
|
||||
|
||||
|
|
@ -1704,9 +1597,7 @@ void LevelChunk::getEntities(std::shared_ptr<Entity> except, AABB* bb,
|
|||
}
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb,
|
||||
|
|
@ -1726,11 +1617,9 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb,
|
|||
yc1 = 0;
|
||||
}
|
||||
|
||||
#if 1
|
||||
// AP - RW critical sections are expensive so enter once in
|
||||
// Level::getEntitiesOfClass
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
for (int yc = yc0; yc <= yc1; yc++) {
|
||||
std::vector<std::shared_ptr<Entity> >* entities = entityBlocks[yc];
|
||||
|
||||
|
|
@ -1770,14 +1659,12 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb,
|
|||
// baseClass.isAssignableFrom(e.getClass())
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
#endif
|
||||
}
|
||||
|
||||
int LevelChunk::countEntities() {
|
||||
int entityCount = 0;
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&m_csEntities, false);
|
||||
#else
|
||||
EnterCriticalSection(&m_csEntities);
|
||||
|
|
@ -1785,7 +1672,7 @@ int LevelChunk::countEntities() {
|
|||
for (int yc = 0; yc < ENTITY_BLOCKS_LENGTH; yc++) {
|
||||
entityCount += (int)entityBlocks[yc]->size();
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&m_csEntities, false);
|
||||
#else
|
||||
LeaveCriticalSection(&m_csEntities);
|
||||
|
|
@ -2063,17 +1950,6 @@ Random* LevelChunk::getRandom(int64_t l) {
|
|||
bool LevelChunk::isEmpty() { return false; }
|
||||
void LevelChunk::attemptCompression() {
|
||||
// 4J - removed
|
||||
#if 0
|
||||
try {
|
||||
ByteArrayOutputStream *baos = new ByteArrayOutputStream();
|
||||
GZIPOutputStream *gzos = new GZIPOutputStream(baos);
|
||||
DataOutputStream *dos = new DataOutputStream(gzos);
|
||||
dos.close();
|
||||
System.out.println("Compressed size: " + baos.toByteArray().length);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LevelChunk::checkPostProcess(ChunkSource* source, ChunkSource* parent,
|
||||
|
|
@ -2330,7 +2206,7 @@ void LevelChunk::compressLighting() {
|
|||
}
|
||||
|
||||
void LevelChunk::compressBlocks() {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
CompressedTileStorage* blocksToCompressLower = NULL;
|
||||
CompressedTileStorage* blocksToCompressUpper = NULL;
|
||||
|
||||
|
|
@ -2429,7 +2305,7 @@ void LevelChunk::readCompressedBlockLightData(DataInputStream* dis) {
|
|||
// can only compress if the data is being shared, and nothing else is trying to
|
||||
// update it from another thread.
|
||||
void LevelChunk::compressData() {
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
SparseDataStorage* dataToCompressLower = NULL;
|
||||
SparseDataStorage* dataToCompressUpper = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ class EntitySelector;
|
|||
#define SHARING_ENABLED
|
||||
class TileCompressData_SPU;
|
||||
|
||||
#if 0 //0
|
||||
#define _ENTITIES_RW_SECTION
|
||||
#endif
|
||||
|
||||
class LevelChunk {
|
||||
friend class TileCompressData_SPU;
|
||||
|
|
@ -162,7 +159,7 @@ protected:
|
|||
public:
|
||||
bool dontSave;
|
||||
bool lastSaveHadEntities;
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
bool sharingTilesAndData; // 4J added
|
||||
#endif
|
||||
bool emissiveAdded; // 4J added
|
||||
|
|
@ -175,7 +172,7 @@ public:
|
|||
int lowestHeightmap;
|
||||
int64_t inhabitedTime;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
bool m_bUnloaded;
|
||||
CompoundTag* m_unloadedEntitiesTag;
|
||||
#endif
|
||||
|
|
@ -242,7 +239,7 @@ public:
|
|||
virtual void load();
|
||||
virtual void unload(bool unloadTileEntities); // 4J - added parameter
|
||||
virtual bool containsPlayer(); // 4J - added
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
virtual bool isUnloaded();
|
||||
#endif
|
||||
virtual void markUnsaved();
|
||||
|
|
@ -271,11 +268,11 @@ public:
|
|||
virtual bool isEmpty();
|
||||
virtual void attemptCompression();
|
||||
|
||||
#ifdef SHARING_ENABLED
|
||||
#if defined(SHARING_ENABLED)
|
||||
static CRITICAL_SECTION m_csSharing; // 4J added
|
||||
#endif
|
||||
// 4J added
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
static CRITICAL_RW_SECTION
|
||||
m_csEntities; // AP - we're using a RW critical so we can do multiple
|
||||
// reads without contention
|
||||
|
|
@ -309,13 +306,13 @@ public:
|
|||
int zs);
|
||||
static void reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs,
|
||||
byteArray* data);
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
int getBlockLightPlanesLower() { return lowerBlockLight->count; }
|
||||
int getSkyLightPlanesLower() { return lowerSkyLight->count; }
|
||||
int getBlockLightPlanesUpper() { return upperBlockLight->count; }
|
||||
int getSkyLightPlanesUpper() { return upperSkyLight->count; }
|
||||
#endif
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
int getDataPlanes() { return data->count; }
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,15 +10,6 @@
|
|||
#include "../Headers/net.minecraft.world.entity.h"
|
||||
#include "RandomLevelSource.h"
|
||||
|
||||
#if 0
|
||||
static PerlinNoise_DataIn g_lperlinNoise1_SPU __attribute__((__aligned__(16)));
|
||||
static PerlinNoise_DataIn g_lperlinNoise2_SPU __attribute__((__aligned__(16)));
|
||||
static PerlinNoise_DataIn g_perlinNoise1_SPU __attribute__((__aligned__(16)));
|
||||
static PerlinNoise_DataIn g_scaleNoise_SPU __attribute__((__aligned__(16)));
|
||||
static PerlinNoise_DataIn g_depthNoise_SPU __attribute__((__aligned__(16)));
|
||||
// #define DISABLE_SPU_CODE
|
||||
|
||||
#endif
|
||||
|
||||
const double RandomLevelSource::SNOW_SCALE = 0.3;
|
||||
const double RandomLevelSource::SNOW_CUTOFF = 0.5;
|
||||
|
|
@ -27,7 +18,7 @@ RandomLevelSource::RandomLevelSource(Level* level, int64_t seed,
|
|||
bool generateStructures)
|
||||
: generateStructures(generateStructures) {
|
||||
m_XZSize = level->getLevelData()->getXZSize();
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
level->getLevelData()->getMoatFlags(&m_classicEdgeMoat, &m_smallEdgeMoat,
|
||||
&m_mediumEdgeMoat);
|
||||
#endif
|
||||
|
|
@ -95,7 +86,7 @@ int g_numPrepareHeightCalls = 0;
|
|||
LARGE_INTEGER g_totalPrepareHeightsTime = {0, 0};
|
||||
LARGE_INTEGER g_averagePrepareHeightsTime = {0, 0};
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
|
||||
int RandomLevelSource::getMinDistanceToEdge(int xxx, int zzz, int worldSize,
|
||||
float falloffStart) {
|
||||
|
|
@ -227,7 +218,7 @@ float RandomLevelSource::getHeightFalloff(int xxx, int zzz, int* pEMin) {
|
|||
return comp;
|
||||
}
|
||||
|
||||
#endif // _LARGE_WORLDS
|
||||
#endif
|
||||
|
||||
void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) {
|
||||
LARGE_INTEGER startTime;
|
||||
|
|
@ -564,30 +555,6 @@ doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y,
|
|||
0, 500.0);
|
||||
}
|
||||
|
||||
#if 0 && !defined DISABLE_SPU_CODE
|
||||
C4JSpursJobQueue::Port port("C4JSpursJob_PerlinNoise");
|
||||
C4JSpursJob_PerlinNoise perlinJob1(&g_scaleNoise_SPU);
|
||||
C4JSpursJob_PerlinNoise perlinJob2(&g_depthNoise_SPU);
|
||||
C4JSpursJob_PerlinNoise perlinJob3(&g_perlinNoise1_SPU);
|
||||
C4JSpursJob_PerlinNoise perlinJob4(&g_lperlinNoise1_SPU);
|
||||
C4JSpursJob_PerlinNoise perlinJob5(&g_lperlinNoise2_SPU);
|
||||
|
||||
g_scaleNoise_SPU.set(scaleNoise, sr, x, z, xSize, zSize, 1.121, 1.121, 0.5);
|
||||
g_depthNoise_SPU.set(depthNoise, dr, x, z, xSize, zSize, 200.0, 200.0, 0.5);
|
||||
g_perlinNoise1_SPU.set(perlinNoise1, pnr, x, y, z, xSize, ySize, zSize,
|
||||
s / 80.0, hs / 160.0, s / 80.0);
|
||||
g_lperlinNoise1_SPU.set(lperlinNoise1, ar, x, y, z, xSize, ySize, zSize, s,
|
||||
hs, s);
|
||||
g_lperlinNoise2_SPU.set(lperlinNoise2, br, x, y, z, xSize, ySize, zSize, s,
|
||||
hs, s);
|
||||
|
||||
port.submitJob(&perlinJob1);
|
||||
port.submitJob(&perlinJob2);
|
||||
port.submitJob(&perlinJob3);
|
||||
port.submitJob(&perlinJob4);
|
||||
port.submitJob(&perlinJob5);
|
||||
port.waitForCompletion();
|
||||
#else
|
||||
sr = scaleNoise->getRegion(sr, x, z, xSize, zSize, 1.121, 1.121, 0.5);
|
||||
dr = depthNoise->getRegion(dr, x, z, xSize, zSize, 200.0, 200.0, 0.5);
|
||||
pnr = perlinNoise1->getRegion(pnr, x, y, z, xSize, ySize, zSize, s / 80.0,
|
||||
|
|
@ -595,7 +562,6 @@ doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y,
|
|||
ar = lperlinNoise1->getRegion(ar, x, y, z, xSize, ySize, zSize, s, hs, s);
|
||||
br = lperlinNoise2->getRegion(br, x, y, z, xSize, ySize, zSize, s, hs, s);
|
||||
|
||||
#endif
|
||||
|
||||
x = z = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,12 +40,8 @@ void ChunkStorageProfilerDecorator::tick() {
|
|||
counter++;
|
||||
if (counter > 500) {
|
||||
if (loadCount > 0) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if 0
|
||||
sprintf(buf, "Average load time: %f (%lld)",
|
||||
0.000001 * (double)timeSpentLoading / (double)loadCount,
|
||||
loadCount);
|
||||
#elif defined(__linux__)
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if defined(__linux__)
|
||||
sprintf(buf, "Average load time: %f (%lld)",
|
||||
0.000001 * (double)timeSpentLoading / (double)loadCount,
|
||||
(long long)loadCount);
|
||||
|
|
@ -58,12 +54,8 @@ void ChunkStorageProfilerDecorator::tick() {
|
|||
#endif
|
||||
}
|
||||
if (saveCount > 0) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if 0
|
||||
sprintf(buf, "Average save time: %f (%lld)",
|
||||
0.000001 * (double)timeSpentSaving / (double)loadCount,
|
||||
loadCount);
|
||||
#elif defined(__linux__)
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if defined(__linux__)
|
||||
sprintf(buf, "Average save time: %f (%lld)",
|
||||
0.000001 * (double)timeSpentSaving / (double)loadCount,
|
||||
(long long)loadCount);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,7 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
#include "CompressedTileStorage.h"
|
||||
|
||||
#if 0
|
||||
#define PSVITA_PRECOMPUTED_TABLE
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static const int sc_maxCompressTiles = 64;
|
||||
static CompressedTileStorage_compress_dataIn
|
||||
g_compressTileDataIn[sc_maxCompressTiles] __attribute__((__aligned__(16)));
|
||||
static int g_currentCompressTiles = 0;
|
||||
// #define DISABLE_SPU_CODE
|
||||
#endif //0
|
||||
|
||||
// Note: See header for an overview of this class
|
||||
|
||||
|
|
@ -20,7 +10,7 @@ XLockFreeStack<unsigned char> CompressedTileStorage::deleteQueue[3];
|
|||
|
||||
CRITICAL_SECTION CompressedTileStorage::cs_write;
|
||||
|
||||
#ifdef PSVITA_PRECOMPUTED_TABLE
|
||||
#if defined(PSVITA_PRECOMPUTED_TABLE)
|
||||
// AP - this will create a precomputed table to speed up getData
|
||||
static int* CompressedTile_StorageIndexTable = NULL;
|
||||
|
||||
|
|
@ -39,7 +29,7 @@ CompressedTileStorage::CompressedTileStorage() {
|
|||
indicesAndData = NULL;
|
||||
allocatedSize = 0;
|
||||
|
||||
#ifdef PSVITA_PRECOMPUTED_TABLE
|
||||
#if defined(PSVITA_PRECOMPUTED_TABLE)
|
||||
CompressedTileStorage_InitTable();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -57,7 +47,7 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage* copyFrom) {
|
|||
}
|
||||
LeaveCriticalSection(&cs_write);
|
||||
|
||||
#ifdef PSVITA_PRECOMPUTED_TABLE
|
||||
#if defined(PSVITA_PRECOMPUTED_TABLE)
|
||||
CompressedTileStorage_InitTable();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -98,7 +88,7 @@ CompressedTileStorage::CompressedTileStorage(byteArray initFrom,
|
|||
// only needs to be the actual size of the data used rather than
|
||||
// the one rounded up to a page size actually allocated
|
||||
|
||||
#ifdef PSVITA_PRECOMPUTED_TABLE
|
||||
#if defined(PSVITA_PRECOMPUTED_TABLE)
|
||||
CompressedTileStorage_InitTable();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -113,15 +103,8 @@ CompressedTileStorage::CompressedTileStorage(bool isEmpty) {
|
|||
|
||||
// Empty and already compressed, so we only need 1K. Rounding up to nearest
|
||||
// 4096 bytes for allocation
|
||||
#if 0
|
||||
// XPhysicalAlloc just maps to malloc on PS3, so allocate the smallest
|
||||
// amount
|
||||
indicesAndData = (unsigned char*)XPhysicalAlloc(1024, MAXULONG_PTR, 4096,
|
||||
PAGE_READWRITE);
|
||||
#else
|
||||
indicesAndData = (unsigned char*)XPhysicalAlloc(4096, MAXULONG_PTR, 4096,
|
||||
PAGE_READWRITE);
|
||||
#endif //0
|
||||
unsigned short* indices = (unsigned short*)indicesAndData;
|
||||
// unsigned char *data = indicesAndData + 1024;
|
||||
|
||||
|
|
@ -135,7 +118,7 @@ CompressedTileStorage::CompressedTileStorage(bool isEmpty) {
|
|||
// only needs to be the actual size of the data used rather than
|
||||
// the one rounded up to a page size actually allocated
|
||||
|
||||
#ifdef PSVITA_PRECOMPUTED_TABLE
|
||||
#if defined(PSVITA_PRECOMPUTED_TABLE)
|
||||
CompressedTileStorage_InitTable();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -207,15 +190,7 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage* other) {
|
|||
}
|
||||
|
||||
CompressedTileStorage::~CompressedTileStorage() {
|
||||
#if 1
|
||||
if (indicesAndData) XPhysicalFree(indicesAndData);
|
||||
#else
|
||||
if ((unsigned int)indicesAndData >= MM_PHYSICAL_4KB_BASE) {
|
||||
if (indicesAndData) XPhysicalFree(indicesAndData);
|
||||
} else {
|
||||
if (indicesAndData) free(indicesAndData);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get an index into the normal ordering of tiles for the java game, given a
|
||||
|
|
@ -301,31 +276,6 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) {
|
|||
// and require no storage. Store flags for each tile type used in an
|
||||
// array of 4 64-bit flags.
|
||||
|
||||
#if 0
|
||||
// AP - Vita isn't so great at shifting 64bits. The top biggest CPU time
|
||||
// sink after profiling is __ashldi3 (64bit shift) at 3% Let's use 32bit
|
||||
// instead
|
||||
unsigned int usedFlags[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
__int32 i32_1 = 1;
|
||||
for (int j = 0; j < 64; j++) // This loop of 64 is to go round the 4 x
|
||||
// 4 tiles in the block
|
||||
{
|
||||
int tile = data[getIndex(i, j)];
|
||||
if (tile < (64 << 2)) {
|
||||
usedFlags[tile & 7] |= (i32_1 << (tile >> 3));
|
||||
}
|
||||
}
|
||||
int count = 0;
|
||||
for (int tile = 0; tile < 256;
|
||||
tile++) // This loop of 256 is to go round the 256 possible values
|
||||
// that the tiles might have had to find how many are
|
||||
// actually used
|
||||
{
|
||||
if (usedFlags[tile & 7] & (i32_1 << (tile >> 3))) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
uint64_t usedFlags[4] = {0, 0, 0, 0};
|
||||
int64_t i64_1 = 1; // MGH - instead of 1i64, which is MS specific
|
||||
for (int j = 0; j < 64; j++) // This loop of 64 is to go round the 4 x
|
||||
|
|
@ -345,7 +295,6 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) {
|
|||
count++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (count == 1) {
|
||||
_blockIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG;
|
||||
// type0++;
|
||||
|
|
@ -460,7 +409,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) {
|
|||
LeaveCriticalSection(&cs_write);
|
||||
}
|
||||
|
||||
#ifdef PSVITA_PRECOMPUTED_TABLE
|
||||
#if defined(PSVITA_PRECOMPUTED_TABLE)
|
||||
|
||||
// AP - When called in pairs from LevelChunk::getBlockData this version of
|
||||
// getData reduces the time from ~5.2ms to ~1.6ms on the Vita Gets all tile
|
||||
|
|
@ -820,51 +769,12 @@ void CompressedTileStorage::tick() {
|
|||
do {
|
||||
toFree = deleteQueue[freeIndex].Pop();
|
||||
// if( toFree ) printf("Deleting 0x%x\n", toFree);
|
||||
#if 1
|
||||
if (toFree) XPhysicalFree(toFree);
|
||||
#else
|
||||
// Determine correct means to free this data - could have been allocated
|
||||
// either with XPhysicalAlloc or malloc
|
||||
if ((unsigned int)toFree >= MM_PHYSICAL_4KB_BASE) {
|
||||
XPhysicalFree(toFree);
|
||||
} else {
|
||||
free(toFree);
|
||||
}
|
||||
#endif
|
||||
} while (toFree);
|
||||
|
||||
deleteQueueIndex = (deleteQueueIndex + 1) % 3;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void CompressedTileStorage::compress_SPU(int upgradeBlock /*=-1*/) {
|
||||
EnterCriticalSection(&cs_write);
|
||||
static unsigned char compBuffer[32768 + 4096]
|
||||
__attribute__((__aligned__(16)));
|
||||
CompressedTileStorage_compress_dataIn& dataIn = g_compressTileDataIn[0];
|
||||
dataIn.allocatedSize = allocatedSize;
|
||||
dataIn.indicesAndData = indicesAndData;
|
||||
dataIn.newIndicesAndData = compBuffer;
|
||||
dataIn.upgradeBlock = upgradeBlock;
|
||||
|
||||
static C4JSpursJobQueue::Port p("CompressedTileStorage::compress_SPU");
|
||||
C4JSpursJob_CompressedTileStorage_compress compressJob(&dataIn);
|
||||
p.submitJob(&compressJob);
|
||||
p.waitForCompletion();
|
||||
|
||||
if (dataIn.neededCompressed) {
|
||||
unsigned char* newIndicesAndData = (unsigned char*)XPhysicalAlloc(
|
||||
dataIn.newAllocatedSize, MAXULONG_PTR, 4096,
|
||||
PAGE_READWRITE); //(unsigned char *)malloc( memToAlloc );
|
||||
memcpy(newIndicesAndData, compBuffer, dataIn.newAllocatedSize);
|
||||
queueForDelete(indicesAndData);
|
||||
indicesAndData = newIndicesAndData;
|
||||
allocatedSize = dataIn.newAllocatedSize;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&cs_write);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Compresses the data currently stored in one of two ways:
|
||||
// (1) Attempt to compresses every block as much as possible (if upgradeBlock is
|
||||
|
|
@ -872,10 +782,6 @@ void CompressedTileStorage::compress_SPU(int upgradeBlock /*=-1*/) {
|
|||
// ( if > -1 ), which is changed to be the next-most-accomodating storage from
|
||||
// its current state
|
||||
void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
|
||||
#if 0 && !defined DISABLE_SPU_CODE
|
||||
compress_SPU(upgradeBlock);
|
||||
return;
|
||||
#endif
|
||||
|
||||
unsigned char tempdata[64];
|
||||
unsigned short _blockIndices[512];
|
||||
|
|
@ -951,29 +857,6 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
|
|||
// compress any further and require no storage. Store flags for
|
||||
// each tile type used in an array of 4 64-bit flags.
|
||||
|
||||
#if 0
|
||||
// AP - Vita isn't so great at shifting 64bits. The top biggest
|
||||
// CPU time sink after profiling is __ashldi3 (64bit shift) at
|
||||
// 3% lets use 32bit values instead
|
||||
unsigned int usedFlags[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
__int32 i32_1 = 1;
|
||||
for (int j = 0; j < 64; j++) // This loop of 64 is to go round
|
||||
// the 4x4x4 tiles in the block
|
||||
{
|
||||
int tiletype = unpacked_data[j];
|
||||
usedFlags[tiletype & 7] |= (i32_1 << (tiletype >> 3));
|
||||
}
|
||||
// count the number of bits set using the 'Hammering Weight'
|
||||
// method. This reduces ::compress total thread cpu consumption
|
||||
// from 10% to 4%
|
||||
unsigned int count = 0;
|
||||
for (int Index = 0; Index < 8; Index += 1) {
|
||||
unsigned int i = usedFlags[Index];
|
||||
i = i - ((i >> 1) & 0x55555555);
|
||||
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
|
||||
count += (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
|
||||
}
|
||||
#else
|
||||
|
||||
uint64_t usedFlags[4] = {0, 0, 0, 0};
|
||||
int64_t i64_1 =
|
||||
|
|
@ -994,7 +877,6 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
|
|||
count++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (count == 1) {
|
||||
_blockIndices[i] =
|
||||
|
|
@ -1076,11 +958,9 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
|
|||
PAGE_READWRITE); //(unsigned char *)malloc( memToAlloc );
|
||||
if (newIndicesAndData == NULL) {
|
||||
DWORD lastError = GetLastError();
|
||||
#if 1
|
||||
MEMORYSTATUS memStatus;
|
||||
GlobalMemoryStatus(&memStatus);
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
unsigned char* pucData = newIndicesAndData + 1024;
|
||||
unsigned short usDataOffset = 0;
|
||||
|
|
@ -1181,13 +1061,9 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
|
|||
|
||||
// And finally repack
|
||||
unsigned char ucMappings[256] = {0};
|
||||
#if 0
|
||||
memset(ucMappings, 255, 256);
|
||||
#else
|
||||
for (int j = 0; j < 256; j++) {
|
||||
ucMappings[j] = 255;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned char* repacked = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__)
|
||||
#include "../../Platform/x64headers/xmcore.h"
|
||||
#endif // __linux__
|
||||
#endif
|
||||
|
||||
// This class is used for the compressed storage of tile data. Unlike the
|
||||
// SparseLightingStorage class, data is split into 512 blocks of 4x4x4 tiles.
|
||||
|
|
@ -147,9 +147,6 @@ public:
|
|||
static void staticCtor();
|
||||
|
||||
void compress(int upgradeBlock = -1);
|
||||
#if 0
|
||||
void compress_SPU(int upgradeBlock = -1);
|
||||
#endif
|
||||
|
||||
public:
|
||||
void queueForDelete(unsigned char* data);
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@
|
|||
const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/");
|
||||
|
||||
_MapDataMappings::_MapDataMappings() {
|
||||
#if 1
|
||||
ZeroMemory(xuids, sizeof(PlayerUID) * MAXIMUM_MAP_SAVE_DATA);
|
||||
#endif
|
||||
ZeroMemory(dimensions, sizeof(uint8_t) * (MAXIMUM_MAP_SAVE_DATA / 4));
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +36,7 @@ int _MapDataMappings::getDimension(int id) {
|
|||
returnVal = 1; // End
|
||||
break;
|
||||
default:
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
printf("Read invalid dimension from MapDataMapping\n");
|
||||
__debugbreak();
|
||||
#endif
|
||||
|
|
@ -65,7 +63,7 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension) {
|
|||
dimensions[id >> 2] |= (2 << offset);
|
||||
break;
|
||||
default:
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
printf(
|
||||
"Trinyg to set a MapDataMapping for an invalid dimension.\n");
|
||||
__debugbreak();
|
||||
|
|
@ -76,9 +74,7 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension) {
|
|||
|
||||
// Old version the only used 1 bit for dimension indexing
|
||||
_MapDataMappings_old::_MapDataMappings_old() {
|
||||
#if 1
|
||||
ZeroMemory(xuids, sizeof(PlayerUID) * MAXIMUM_MAP_SAVE_DATA);
|
||||
#endif
|
||||
ZeroMemory(dimensions, sizeof(uint8_t) * (MAXIMUM_MAP_SAVE_DATA / 8));
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +91,7 @@ void _MapDataMappings_old::setMapping(int id, PlayerUID xuid, int dimension) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX,
|
||||
int centreZ,
|
||||
int dimension,
|
||||
|
|
@ -168,7 +164,7 @@ DirectoryLevelStorage::DirectoryLevelStorage(ConsoleSaveFile* saveFile,
|
|||
m_saveFile = saveFile;
|
||||
m_bHasLoadedMapDataMappings = false;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
m_usedMappings = byteArray(MAXIMUM_MAP_SAVE_DATA / 8);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -181,7 +177,7 @@ DirectoryLevelStorage::~DirectoryLevelStorage() {
|
|||
delete it->second;
|
||||
}
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
delete m_usedMappings.data;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -228,7 +224,7 @@ ChunkStorage* DirectoryLevelStorage::createChunkStorage(Dimension* dimension) {
|
|||
|
||||
LevelData* DirectoryLevelStorage::prepareLevel() {
|
||||
// 4J Stu Added
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
ConsoleSavePath mapFile = getDataFile(L"largeMapDataMappings");
|
||||
#else
|
||||
ConsoleSavePath mapFile = getDataFile(L"mapDataMappings");
|
||||
|
|
@ -238,32 +234,11 @@ LevelData* DirectoryLevelStorage::prepareLevel() {
|
|||
unsigned int NumberOfBytesRead;
|
||||
FileEntry* fileEntry = getSaveFile()->createFile(mapFile);
|
||||
|
||||
#if 0
|
||||
// 4J Stu - This version changed happened before initial release
|
||||
if (getSaveFile()->getSaveVersion() <
|
||||
SAVE_FILE_VERSION_CHANGE_MAP_DATA_MAPPING_SIZE) {
|
||||
// Delete the old file
|
||||
if (fileEntry) getSaveFile()->deleteFile(fileEntry);
|
||||
|
||||
// Save a new, blank version
|
||||
saveMapIdLookup();
|
||||
} else
|
||||
#elif 0
|
||||
// 4J Stu - This version changed happened before initial release
|
||||
if (getSaveFile()->getSaveVersion() <
|
||||
SAVE_FILE_VERSION_DURANGO_CHANGE_MAP_DATA_MAPPING_SIZE) {
|
||||
// Delete the old file
|
||||
if (fileEntry) getSaveFile()->deleteFile(fileEntry);
|
||||
|
||||
// Save a new, blank version
|
||||
saveMapIdLookup();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
getSaveFile()->setFilePointer(fileEntry, 0,
|
||||
SaveFileSeekOrigin::Begin);
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
byteArray data(fileEntry->getFileSize());
|
||||
getSaveFile()->readFile(fileEntry, data.data,
|
||||
fileEntry->getFileSize(),
|
||||
|
|
@ -279,7 +254,7 @@ LevelData* DirectoryLevelStorage::prepareLevel() {
|
|||
#if defined(_WINDOWS64) || defined(__linux__)
|
||||
app.DebugPrintf(" -- %d\n", playerUid);
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
app.DebugPrintf(" -- %d\n", playerUid);
|
||||
#else
|
||||
app.DebugPrintf(" -- %ls\n", playerUid.toString().c_str());
|
||||
|
|
@ -384,24 +359,12 @@ void DirectoryLevelStorage::saveLevelData(LevelData* levelData) {
|
|||
void DirectoryLevelStorage::save(std::shared_ptr<Player> player) {
|
||||
// 4J Jev, removed try/catch.
|
||||
PlayerUID playerXuid = player->getXuid();
|
||||
#if 0 || 0
|
||||
if (playerXuid != INVALID_XUID)
|
||||
#else
|
||||
if (playerXuid != INVALID_XUID && !player->isGuest())
|
||||
#endif
|
||||
{
|
||||
CompoundTag* tag = new CompoundTag();
|
||||
player->saveWithoutId(tag);
|
||||
#if 0 || 0 || 0
|
||||
ConsoleSavePath realFile = ConsoleSavePath(
|
||||
m_saveFile->getPlayerDataFilenameForSave(playerXuid).c_str());
|
||||
#elif 0
|
||||
ConsoleSavePath realFile = ConsoleSavePath(
|
||||
playerDir.getName() + player->getXuid().toString() + L".dat");
|
||||
#else
|
||||
ConsoleSavePath realFile = ConsoleSavePath(
|
||||
playerDir.getName() + _toString(player->getXuid()) + L".dat");
|
||||
#endif
|
||||
// If saves are disabled (e.g. because we are writing the save buffer to
|
||||
// disk) then cache this player data
|
||||
if (StorageManager.GetSaveDisabled()) {
|
||||
|
|
@ -439,16 +402,8 @@ CompoundTag* DirectoryLevelStorage::load(std::shared_ptr<Player> player) {
|
|||
|
||||
CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) {
|
||||
// 4J Jev, removed try/catch.
|
||||
#if 0 || 0 || 0
|
||||
ConsoleSavePath realFile =
|
||||
ConsoleSavePath(m_saveFile->getPlayerDataFilenameForLoad(xuid).c_str());
|
||||
#elif 0
|
||||
ConsoleSavePath realFile =
|
||||
ConsoleSavePath(playerDir.getName() + xuid.toString() + L".dat");
|
||||
#else
|
||||
ConsoleSavePath realFile =
|
||||
ConsoleSavePath(playerDir.getName() + _toString(xuid) + L".dat");
|
||||
#endif
|
||||
AUTO_VAR(it, m_cachedSaveData.find(realFile.getName()));
|
||||
if (it != m_cachedSaveData.end()) {
|
||||
ByteArrayOutputStream* bos = it->second;
|
||||
|
|
@ -470,15 +425,11 @@ CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) {
|
|||
void DirectoryLevelStorage::clearOldPlayerFiles() {
|
||||
if (StorageManager.GetSaveDisabled()) return;
|
||||
|
||||
#if 0 || 0 || 0
|
||||
std::vector<FileEntry*>* playerFiles = m_saveFile->getValidPlayerDatFiles();
|
||||
#else
|
||||
std::vector<FileEntry*>* playerFiles =
|
||||
m_saveFile->getFilesWithPrefix(playerDir.getName());
|
||||
#endif
|
||||
|
||||
if (playerFiles != NULL) {
|
||||
#ifndef _FINAL_BUILD
|
||||
#if !defined(_FINAL_BUILD)
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_DistributableSave)) {
|
||||
|
|
@ -487,11 +438,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() {
|
|||
std::wstring xuidStr = replaceAll(
|
||||
replaceAll(file->data.filename, playerDir.getName(), L""),
|
||||
L".dat", L"");
|
||||
#if 0 || 0 || 0
|
||||
PlayerUID xuid(xuidStr);
|
||||
#else
|
||||
PlayerUID xuid = _fromString<PlayerUID>(xuidStr);
|
||||
#endif
|
||||
deleteMapFilesForPlayer(xuid);
|
||||
m_saveFile->deleteFile(playerFiles->at(i));
|
||||
}
|
||||
|
|
@ -507,11 +454,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() {
|
|||
std::wstring xuidStr = replaceAll(
|
||||
replaceAll(file->data.filename, playerDir.getName(), L""),
|
||||
L".dat", L"");
|
||||
#if 0 || 0 || 0
|
||||
PlayerUID xuid(xuidStr);
|
||||
#else
|
||||
PlayerUID xuid = _fromString<PlayerUID>(xuidStr);
|
||||
#endif
|
||||
deleteMapFilesForPlayer(xuid);
|
||||
m_saveFile->deleteFile(playerFiles->at(i));
|
||||
}
|
||||
|
|
@ -532,7 +475,7 @@ ConsoleSavePath DirectoryLevelStorage::getDataFile(const std::wstring& id) {
|
|||
std::wstring DirectoryLevelStorage::getLevelId() { return levelId; }
|
||||
|
||||
void DirectoryLevelStorage::flushSaveFile(bool autosave) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_DistributableSave)) {
|
||||
|
|
@ -550,13 +493,8 @@ void DirectoryLevelStorage::flushSaveFile(bool autosave) {
|
|||
// 4J Added
|
||||
void DirectoryLevelStorage::resetNetherPlayerPositions() {
|
||||
if (app.GetResetNether()) {
|
||||
#if 0 || 0 || 0
|
||||
std::vector<FileEntry*>* playerFiles =
|
||||
m_saveFile->getValidPlayerDatFiles();
|
||||
#else
|
||||
std::vector<FileEntry*>* playerFiles =
|
||||
m_saveFile->getFilesWithPrefix(playerDir.getName());
|
||||
#endif
|
||||
|
||||
if (playerFiles != NULL) {
|
||||
for (AUTO_VAR(it, playerFiles->begin()); it != playerFiles->end();
|
||||
|
|
@ -596,7 +534,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension,
|
|||
int mapId = -1;
|
||||
bool foundMapping = false;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
AUTO_VAR(it, m_playerMappings.find(xuid));
|
||||
if (it != m_playerMappings.end()) {
|
||||
foundMapping =
|
||||
|
|
@ -656,7 +594,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension,
|
|||
void DirectoryLevelStorage::saveMapIdLookup() {
|
||||
if (StorageManager.GetSaveDisabled()) return;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
ConsoleSavePath file = getDataFile(L"largeMapDataMappings");
|
||||
#else
|
||||
ConsoleSavePath file = getDataFile(L"mapDataMappings");
|
||||
|
|
@ -667,7 +605,7 @@ void DirectoryLevelStorage::saveMapIdLookup() {
|
|||
FileEntry* fileEntry = m_saveFile->createFile(file);
|
||||
m_saveFile->setFilePointer(fileEntry, 0, SaveFileSeekOrigin::Begin);
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
dos.writeInt(m_playerMappings.size());
|
||||
|
|
@ -677,7 +615,7 @@ void DirectoryLevelStorage::saveMapIdLookup() {
|
|||
#if defined(_WINDOWS64) || defined(__linux__)
|
||||
app.DebugPrintf(" -- %d\n", it->first);
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
app.DebugPrintf(" -- %d\n", it->first);
|
||||
#else
|
||||
app.DebugPrintf(" -- %ls\n", it->first.toString().c_str());
|
||||
|
|
@ -705,7 +643,7 @@ void DirectoryLevelStorage::saveMapIdLookup() {
|
|||
}
|
||||
|
||||
void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid) {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
AUTO_VAR(it, m_playerMappings.find(xuid));
|
||||
if (it != m_playerMappings.end()) {
|
||||
for (AUTO_VAR(itMap, it->second.m_mappings.begin());
|
||||
|
|
@ -732,7 +670,7 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(
|
|||
}
|
||||
|
||||
void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
AUTO_VAR(it, m_playerMappings.find(xuid));
|
||||
if (it != m_playerMappings.end()) {
|
||||
for (AUTO_VAR(itMap, it->second.m_mappings.begin());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
// 51 maps per player (7x7 overworld, 1 nether, 1 end) * 100 players rounded up
|
||||
// to power of 2
|
||||
#define MAXIMUM_MAP_SAVE_DATA 8192 // 65536
|
||||
|
|
@ -70,7 +70,7 @@ private:
|
|||
|
||||
static const std::wstring sc_szPlayerDir;
|
||||
// 4J Added
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
class PlayerMappings {
|
||||
friend class DirectoryLevelStorage;
|
||||
|
||||
|
|
@ -85,13 +85,7 @@ private:
|
|||
void writeMappings(DataOutputStream* dos);
|
||||
void readMappings(DataInputStream* dis);
|
||||
};
|
||||
#if 0 || 0 || 0 || \
|
||||
0
|
||||
std::unordered_map<PlayerUID, PlayerMappings, PlayerUID::Hash>
|
||||
m_playerMappings;
|
||||
#else
|
||||
std::unordered_map<PlayerUID, PlayerMappings> m_playerMappings;
|
||||
#endif
|
||||
byteArray m_usedMappings;
|
||||
#else
|
||||
MapDataMappings m_mapDataMappings;
|
||||
|
|
|
|||
|
|
@ -22,18 +22,6 @@ std::wstring DirectoryLevelStorageSource::getName() { return L"Old Format"; }
|
|||
std::vector<LevelSummary*>* DirectoryLevelStorageSource::getLevelList() {
|
||||
// 4J Stu - We don't use directory list with the Xbox save locations
|
||||
std::vector<LevelSummary*>* levels = new std::vector<LevelSummary*>;
|
||||
#if 0
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
std::wstring levelId = std::wstring(L"World").append( _toString( (i+1) ) );
|
||||
|
||||
LevelData *levelData = getDataTagFor(saveFile, levelId);
|
||||
if (levelData != NULL)
|
||||
{
|
||||
levels->push_back(new LevelSummary(levelId, L"", levelData->getLastPlayed(), levelData->getSizeOnDisk(), levelData.getGameType(), false, levelData->isHardcore()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return levels;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(
|
|||
data[0] = 1;
|
||||
for (unsigned int i = 0; i < parent->decorations.size(); i++) {
|
||||
MapDecoration* md = parent->decorations.at(i);
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
data[i * DEC_PACKET_BYTES + 1] = (char)(md->img);
|
||||
data[i * DEC_PACKET_BYTES + 8] = (char)(md->rot & 0xF);
|
||||
#else
|
||||
|
|
@ -92,7 +92,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(
|
|||
for (AUTO_VAR(it, parent->nonPlayerDecorations.begin());
|
||||
it != parent->nonPlayerDecorations.end(); ++it) {
|
||||
MapDecoration* md = it->second;
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
data[dataIndex * DEC_PACKET_BYTES + 1] = (char)(md->img);
|
||||
data[dataIndex * DEC_PACKET_BYTES + 8] = (char)(md->rot & 0xF);
|
||||
#else
|
||||
|
|
@ -237,9 +237,6 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
|||
|
||||
// 4J Stu - Put this block back in if you want to display entity positions
|
||||
// on a map (see below)
|
||||
#if 0
|
||||
nonPlayerDecorations.clear();
|
||||
#endif
|
||||
bool addedPlayers = false;
|
||||
for (AUTO_VAR(it, carriedBy.begin()); it != carriedBy.end();) {
|
||||
std::shared_ptr<HoldingPlayer> hp = *it;
|
||||
|
|
@ -299,7 +296,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
|||
char x = (char)(xd * 2 + 0.5);
|
||||
char y = (char)(yd * 2 + 0.5);
|
||||
int size = MAP_SIZE - 1;
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
if (xd < -size || yd < -size || xd > size || yd > size) {
|
||||
if (xd <= -size) x = (uint8_t)(size * 2 + 2.5);
|
||||
if (yd <= -size) y = (uint8_t)(size * 2 + 2.5);
|
||||
|
|
@ -342,7 +339,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
|||
10);
|
||||
rot = (char)((s * s * 34187121 + s * 121) >> 15 & 15);
|
||||
}
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
if (xd < -size || yd < -size || xd > size || yd > size) {
|
||||
if (xd <= -size) x = (uint8_t)(size * 2 + 2.5);
|
||||
if (yd <= -size) y = (uint8_t)(size * 2 + 2.5);
|
||||
|
|
@ -362,38 +359,6 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
|||
|
||||
// 4J Stu - Put this block back in if you want to display entity
|
||||
// positions on a map (see above as well)
|
||||
#if 0
|
||||
for(AUTO_VAR(it,playerLevel->entities.begin()); it != playerLevel->entities.end(); ++it)
|
||||
{
|
||||
std::shared_ptr<Entity> ent = *it;
|
||||
|
||||
if((ent->GetType() & eTYPE_ENEMY) == 0) continue;
|
||||
|
||||
float xd = (float) ( ent->x - x ) / (1 << scale);
|
||||
float yd = (float) ( ent->z - z ) / (1 << scale);
|
||||
char x = (char) (xd * 2 + 0.5);
|
||||
char y = (char) (yd * 2 + 0.5);
|
||||
int size = MAP_SIZE - 1;
|
||||
char rot = 0;
|
||||
if (dimension < 0)
|
||||
{
|
||||
int s = step / 10;
|
||||
rot = (char) ((s * s * 34187121 + s * 121) >> 15 & 15);
|
||||
}
|
||||
#ifdef _LARGE_WORLDS
|
||||
if (xd < -size || yd < -size || xd > size || yd > size)
|
||||
{
|
||||
|
||||
if (xd <= -size) x = (uint8_t) (size * 2 + 2.5);
|
||||
if (yd <= -size) y = (uint8_t) (size * 2 + 2.5);
|
||||
if (xd >= size) x = (uint8_t) (size * 2 + 1);
|
||||
if (yd >= size) y = (uint8_t) (size * 2 + 1);
|
||||
}
|
||||
#endif
|
||||
//decorations.push_back(new MapDecoration(7, x, y, 0));
|
||||
nonPlayerDecorations.insert( std::unordered_map<int, MapDecoration *>::value_type( ent->entityId, new MapDecoration(4, x, y, rot, ent->entityId, true) ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
// 4J-PB - display all the players in the map
|
||||
// For the xbox, x and z are 0
|
||||
|
|
@ -417,7 +382,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
|||
char rot;
|
||||
char imgIndex;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
if (xd > -size && yd > -size && xd <= size &&
|
||||
yd <= size)
|
||||
#endif
|
||||
|
|
@ -439,7 +404,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
|||
imgIndex = (int)decorationPlayer->getPlayerIndex();
|
||||
if (imgIndex > 3) imgIndex += 4;
|
||||
}
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
else // if (abs(xd) < MAP_SIZE * 5 && abs(yd) <
|
||||
// MAP_SIZE * 5)
|
||||
{
|
||||
|
|
@ -536,7 +501,7 @@ void MapItemSavedData::handleComplexItemData(charArray& data) {
|
|||
decorations.clear();
|
||||
for (unsigned int i = 0; i < (data.length - 1) / DEC_PACKET_BYTES;
|
||||
i++) {
|
||||
#ifdef _LARGE_WORLDS
|
||||
#if defined(_LARGE_WORLDS)
|
||||
char img = data[i * DEC_PACKET_BYTES + 1];
|
||||
char rot = data[i * DEC_PACKET_BYTES + 8];
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile* saveFile,
|
|||
m_saveFile->createFile(ConsoleSavePath(L"r.-1.0.mcr"));
|
||||
}
|
||||
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
ConsoleSavePath currentFile =
|
||||
ConsoleSavePath(m_prefix + std::wstring(L"entities.dat"));
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) {
|
|||
DataInputStream* regionChunkInputStream =
|
||||
RegionFileCache::getChunkDataInputStream(m_saveFile, m_prefix, x, z);
|
||||
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
// If we can't find the chunk in the save file, then we should remove any
|
||||
// entities we might have for that chunk
|
||||
if (regionChunkInputStream == NULL) {
|
||||
|
|
@ -156,12 +156,12 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) {
|
|||
// levelChunk = OldChunkStorage::load(level,
|
||||
// chunkData->getCompound(L"Level")); MemSect(0);
|
||||
}
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
loadEntities(level, levelChunk);
|
||||
#endif
|
||||
delete chunkData;
|
||||
}
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (levelChunk && app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
|
|
@ -243,7 +243,7 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) {
|
|||
}
|
||||
|
||||
void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) {
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
PIXBeginNamedEvent(0, "Saving entities");
|
||||
// 4j added cast to unsigned and changed index to u
|
||||
uint64_t index = ((uint64_t)(uint32_t)(levelChunk->x) << 32) |
|
||||
|
|
@ -276,7 +276,7 @@ void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) {
|
|||
}
|
||||
|
||||
void McRegionChunkStorage::loadEntities(Level* level, LevelChunk* levelChunk) {
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
int64_t index = ((int64_t)(levelChunk->x) << 32) |
|
||||
(((int64_t)(levelChunk->z)) & 0x00000000FFFFFFFF);
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ void McRegionChunkStorage::loadEntities(Level* level, LevelChunk* levelChunk) {
|
|||
void McRegionChunkStorage::tick() { m_saveFile->tick(); }
|
||||
|
||||
void McRegionChunkStorage::flush() {
|
||||
#ifdef SPLIT_SAVES
|
||||
#if defined(SPLIT_SAVES)
|
||||
PIXBeginNamedEvent(0, "Flushing entity data");
|
||||
ConsoleSavePath currentFile =
|
||||
ConsoleSavePath(m_prefix + std::wstring(L"entities.dat"));
|
||||
|
|
@ -336,15 +336,6 @@ void McRegionChunkStorage::staticCtor() {
|
|||
s_saveThreads[i]->SetProcessor(CPU_CORE_SAVE_THREAD_A);
|
||||
else if (i == 1) {
|
||||
s_saveThreads[i]->SetProcessor(CPU_CORE_SAVE_THREAD_B);
|
||||
#if 0
|
||||
s_saveThreads[i]->SetPriority(
|
||||
THREAD_PRIORITY_BELOW_NORMAL); // On Orbis, this core is also
|
||||
// used for Matching 2, and that
|
||||
// priority of that seems to be
|
||||
// always at default no matter
|
||||
// what we set it to. Prioritise
|
||||
// this below Matching 2.
|
||||
#endif
|
||||
} else if (i == 2)
|
||||
s_saveThreads[i]->SetProcessor(CPU_CORE_SAVE_THREAD_C);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
#include "../../Util/JavaMath.h"
|
||||
#if 0
|
||||
// 4J - not required anymore
|
||||
#include "Matcher.h"
|
||||
#endif
|
||||
#include "../../Util/ProgressListener.h"
|
||||
#include "../../Headers/net.minecraft.world.level.chunk.storage.h"
|
||||
#include "../../Headers/net.minecraft.world.level.chunk.h"
|
||||
|
|
@ -15,12 +11,6 @@
|
|||
|
||||
#include "../../IO/Files/ConsoleSaveFileIO.h"
|
||||
|
||||
#if 0
|
||||
// 4J - not required anymore
|
||||
// These were Pattern class objects, using the c++0x regex class instead
|
||||
const std::tr1::wregex McRegionLevelStorageSource::FolderFilter::chunkFolderPattern = std::tr1::wregex(L"[0-9a-z]|([0-9a-z][0-9a-z])");
|
||||
const std::tr1::wregex McRegionLevelStorageSource::ChunkFilter::chunkFilePattern = std::tr1::wregex(L"c\\.(-?[0-9a-z]+)\\.(-?[0-9a-z]+)\\.dat");
|
||||
#endif
|
||||
|
||||
McRegionLevelStorageSource::McRegionLevelStorageSource(File dir)
|
||||
: DirectoryLevelStorageSource(dir) {}
|
||||
|
|
@ -32,37 +22,6 @@ std::wstring McRegionLevelStorageSource::getName() {
|
|||
std::vector<LevelSummary*>* McRegionLevelStorageSource::getLevelList() {
|
||||
// 4J Stu - We don't need to do directory lookups with the xbox save files
|
||||
std::vector<LevelSummary*>* levels = new std::vector<LevelSummary*>;
|
||||
#if 0
|
||||
std::vector<File *> *subFolders = baseDir.listFiles();
|
||||
File *file;
|
||||
AUTO_VAR(itEnd, subFolders->end());
|
||||
for (AUTO_VAR(it, subFolders->begin()); it != itEnd; it++)
|
||||
{
|
||||
file = *it; //subFolders->at(i);
|
||||
|
||||
if (file->isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::wstring levelId = file->getName();
|
||||
|
||||
LevelData *levelData = getDataTagFor(levelId);
|
||||
if (levelData != NULL)
|
||||
{
|
||||
bool requiresConversion = levelData->getVersion() != McRegionLevelStorage::MCREGION_VERSION_ID;
|
||||
std::wstring levelName = levelData->getLevelName();
|
||||
|
||||
if (levelName.empty()) // 4J Jev TODO: levelName can't be NULL? if (levelName == NULL || isEmpty(levelName))
|
||||
{
|
||||
levelName = levelId;
|
||||
}
|
||||
// long size = getLevelSize(folder);
|
||||
long size = 0;
|
||||
levels->push_back(new LevelSummary(levelId, levelName, levelData->getLastPlayed(), size, requiresConversion, levelData->isHardcore()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return levels;
|
||||
}
|
||||
|
||||
|
|
@ -110,101 +69,9 @@ bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile* saveFile,
|
|||
// Will we ever use this convertLevel function anyway? The main issue is the
|
||||
// check for the hellFolder.exists() which would require a slight change to
|
||||
// the way our save files are structured
|
||||
#if 0
|
||||
progress->progressStagePercentage(0);
|
||||
|
||||
std::vector<ChunkFile *> *normalRegions = new std::vector<ChunkFile *>;
|
||||
std::vector<File *> *normalBaseFolders = new std::vector<File *>;
|
||||
std::vector<ChunkFile *> *netherRegions = new std::vector<ChunkFile *>;
|
||||
std::vector<File *> *netherBaseFolders = new std::vector<File *>;
|
||||
ArrayList<ChunkFile> enderRegions = new ArrayList<ChunkFile>();
|
||||
ArrayList<File> enderBaseFolders = new ArrayList<File>();
|
||||
|
||||
//File baseFolder = File(baseDir, levelId);
|
||||
//File netherFolder = File(baseFolder, LevelStorage::HELL_FOLDER);
|
||||
//File enderFolder = new File(baseFolder, LevelStorage.ENDER_FOLDER);
|
||||
ConsoleSaveFile saveFile = ConsoleSaveFile( levelId );
|
||||
|
||||
// System.out.println("Scanning folders..."); 4J Jev, TODO how do we println ?
|
||||
|
||||
// find normal world
|
||||
addRegions(baseFolder, normalRegions, normalBaseFolders);
|
||||
|
||||
// find hell world
|
||||
if (netherFolder.exists())
|
||||
{
|
||||
addRegions(netherFolder, netherRegions, netherBaseFolders);
|
||||
}
|
||||
if (enderFolder.exists())
|
||||
{
|
||||
addRegions(enderFolder, enderRegions, enderBaseFolders);
|
||||
}
|
||||
|
||||
int totalCount = normalRegions->size() + netherRegions->size() + enderRegions.size() + normalBaseFolders->size() + netherBaseFolders->size() + enderBaseFolders.size();
|
||||
|
||||
// System.out.println("Total conversion count is " + totalCount); 4J Jev, TODO
|
||||
|
||||
// convert normal world
|
||||
convertRegions(baseFolder, normalRegions, 0, totalCount, progress);
|
||||
// convert hell world
|
||||
convertRegions(netherFolder, netherRegions, normalRegions->size(), totalCount, progress);
|
||||
// convert hell world
|
||||
convertRegions(enderFolder, enderRegions, normalRegions.size() + netherRegions.size(), totalCount, progress);
|
||||
|
||||
LevelData *levelData = getDataTagFor(levelId);
|
||||
levelData->setVersion(McRegionLevelStorage::MCREGION_VERSION_ID);
|
||||
|
||||
LevelStorage *levelStorage = selectLevel(levelId, false);
|
||||
levelStorage->saveLevelData(levelData);
|
||||
|
||||
// erase old files
|
||||
eraseFolders(normalBaseFolders, normalRegions->size() + netherRegions->size(), totalCount, progress);
|
||||
if (netherFolder.exists())
|
||||
{
|
||||
eraseFolders(netherBaseFolders, normalRegions->size() + netherRegions->size() + normalBaseFolders->size(), totalCount, progress);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// 4J - not required anymore
|
||||
void McRegionLevelStorageSource::addRegions(File &baseFolder, std::vector<ChunkFile *> *dest, std::vector<File *> *firstLevelFolders)
|
||||
{
|
||||
FolderFilter folderFilter;
|
||||
ChunkFilter chunkFilter;
|
||||
|
||||
File *folder1;
|
||||
std::vector<File *> *folderLevel1 = baseFolder.listFiles((FileFilter *) &folderFilter);
|
||||
AUTO_VAR(itEnd, folderLevel1->end());
|
||||
for (AUTO_VAR(it, folderLevel1->begin()); it != itEnd; it++)
|
||||
{
|
||||
folder1 = *it; //folderLevel1->at(i1);
|
||||
|
||||
// keep this for the clean-up process later on
|
||||
firstLevelFolders->push_back(folder1);
|
||||
|
||||
File *folder2;
|
||||
std::vector<File *> *folderLevel2 = folder1->listFiles(&folderFilter);
|
||||
AUTO_VAR(itEnd2, folderLevel2->end());
|
||||
for (AUTO_VAR(it2, folderLevel2->begin()); it2 != itEnd; it2++)
|
||||
{
|
||||
folder2 = *it2; //folderLevel2->at(i2);
|
||||
|
||||
std::vector<File *> *chunkFiles = folder2->listFiles((FileFilter *) &chunkFilter);
|
||||
|
||||
File *chunk;
|
||||
AUTO_VAR(itEndFile, chunkFiles->end());
|
||||
for (AUTO_VAR(itFile, chunkFiles->begin()); itFile != itEndFile; itFile++)
|
||||
{
|
||||
chunk = *itFile; //chunkFiles->at(i3);
|
||||
|
||||
dest->push_back(new ChunkFile(chunk));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void McRegionLevelStorageSource::convertRegions(
|
||||
File& baseFolder, std::vector<ChunkFile*>* chunkFiles, int currentCount,
|
||||
|
|
@ -212,57 +79,6 @@ void McRegionLevelStorageSource::convertRegions(
|
|||
assert(false);
|
||||
|
||||
// 4J Stu - Removed, see comment in convertLevel above
|
||||
#if 0
|
||||
//Collections::sort(chunkFiles);
|
||||
std::sort( chunkFiles->begin(), chunkFiles->end() );
|
||||
|
||||
byteArray buffer = byteArray(4096);
|
||||
|
||||
ChunkFile *chunkFile;
|
||||
AUTO_VAR(itEnd, chunkFiles->end());
|
||||
for (AUTO_VAR(it, chunkFiles->begin()); it != itEnd; it++)
|
||||
{
|
||||
chunkFile = *it; //chunkFiles->at(i1);
|
||||
|
||||
// Matcher matcher = ChunkFilter.chunkFilePattern.matcher(chunkFile.getName());
|
||||
// if (!matcher.matches()) {
|
||||
// continue;
|
||||
// }
|
||||
// int x = Integer.parseInt(matcher.group(1), 36);
|
||||
// int z = Integer.parseInt(matcher.group(2), 36);
|
||||
|
||||
int x = chunkFile->getX();
|
||||
int z = chunkFile->getZ();
|
||||
|
||||
RegionFile *region = RegionFileCache::getRegionFile(baseFolder, x, z);
|
||||
if (!region->hasChunk(x & 31, z & 31))
|
||||
{
|
||||
FileInputStream fis = new BufferedInputStream(FileInputStream(*chunkFile->getFile()));
|
||||
DataInputStream istream = DataInputStream(&fis); // 4J - was new GZIPInputStream as well
|
||||
|
||||
DataOutputStream *out = region->getChunkDataOutputStream(x & 31, z & 31);
|
||||
|
||||
int length = 0;
|
||||
while ( (length = istream.read(buffer)) != -1 )
|
||||
{
|
||||
out->write(buffer, 0, length);
|
||||
}
|
||||
|
||||
out->close();
|
||||
istream.close();
|
||||
|
||||
// 4J Stu - getChunkDataOutputStream makes a new DataOutputStream that points to a new ChunkBuffer( ByteArrayOutputStream )
|
||||
// We should clean these up when we are done
|
||||
out->deleteChildStream();
|
||||
delete out;
|
||||
}
|
||||
|
||||
currentCount++;
|
||||
int percent = (int) Math::round(100.0 * (double) currentCount / (double) totalCount);
|
||||
progress->progressStagePercentage(percent);
|
||||
}
|
||||
RegionFileCache::clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void McRegionLevelStorageSource::eraseFolders(std::vector<File*>* folders,
|
||||
|
|
@ -284,79 +100,3 @@ void McRegionLevelStorageSource::eraseFolders(std::vector<File*>* folders,
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// 4J - not required anymore
|
||||
bool McRegionLevelStorageSource::FolderFilter::accept(File *file)
|
||||
{
|
||||
if (file->isDirectory())
|
||||
{
|
||||
Matcher matcher( chunkFolderPattern, file->getName() );
|
||||
return matcher.matches();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const std::wstring& name)
|
||||
{
|
||||
Matcher matcher( chunkFilePattern, name );
|
||||
return matcher.matches();
|
||||
}
|
||||
|
||||
|
||||
McRegionLevelStorageSource::ChunkFile::ChunkFile(File *file)
|
||||
{
|
||||
this->file = file;
|
||||
|
||||
Matcher matcher( ChunkFilter::chunkFilePattern, file->getName() );
|
||||
if (matcher.matches())
|
||||
{
|
||||
x = Integer::parseInt(matcher.group(1), 36);
|
||||
z = Integer::parseInt(matcher.group(2), 36);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
|
||||
int McRegionLevelStorageSource::ChunkFile::compareTo(ChunkFile *rhs)
|
||||
{
|
||||
// sort chunk files so that they are placed according to their
|
||||
// region position
|
||||
int rx = x >> 5;
|
||||
int rhsrx = rhs->x >> 5;
|
||||
if (rx == rhsrx)
|
||||
{
|
||||
int rz = z >> 5;
|
||||
int rhsrz = rhs->z >> 5;
|
||||
return rz - rhsrz;
|
||||
}
|
||||
|
||||
return rx - rhsrx;
|
||||
}
|
||||
|
||||
// 4J Stu Added so we can use std::sort instead of the java Collections::sort
|
||||
// a < b
|
||||
bool McRegionLevelStorageSource::ChunkFile::operator<( ChunkFile *b )
|
||||
{
|
||||
return compareTo( b ) < 0;
|
||||
}
|
||||
|
||||
File *McRegionLevelStorageSource::ChunkFile::getFile()
|
||||
{
|
||||
return (File *) file;
|
||||
}
|
||||
|
||||
int McRegionLevelStorageSource::ChunkFile::getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
int McRegionLevelStorageSource::ChunkFile::getZ()
|
||||
{
|
||||
return z;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ public:
|
|||
ProgressListener* progress);
|
||||
|
||||
private:
|
||||
#if 0
|
||||
// 4J - not required anymore
|
||||
void addRegions(File &baseFolder, std::vector<ChunkFile *> *dest, std::vector<File *> *firstLevelFolders);
|
||||
#endif
|
||||
void convertRegions(File& baseFolder, std::vector<ChunkFile*>* chunkFiles,
|
||||
int currentCount, int totalCount,
|
||||
ProgressListener* progress);
|
||||
|
|
@ -38,38 +34,4 @@ private:
|
|||
int totalCount, ProgressListener* progress);
|
||||
|
||||
public:
|
||||
#if 0
|
||||
// 4J - not required anymore
|
||||
static class FolderFilter : public FileFilter
|
||||
{
|
||||
public:
|
||||
static const std::tr1::wregex chunkFolderPattern; // was Pattern
|
||||
bool accept(File *file);
|
||||
};
|
||||
|
||||
static class ChunkFilter : public FilenameFilter
|
||||
{
|
||||
public:
|
||||
static const std::tr1::wregex chunkFilePattern; // was Pattern
|
||||
bool accept(File *dir, const std::wstring& name);
|
||||
};
|
||||
|
||||
static class ChunkFile // implements Comparable<ChunkFile>
|
||||
{
|
||||
private:
|
||||
/* const */ File *file;
|
||||
/* const */ int x;
|
||||
/* const */ int z;
|
||||
|
||||
public:
|
||||
ChunkFile(File *file);
|
||||
int compareTo(ChunkFile *rhs);
|
||||
File *getFile();
|
||||
int getX();
|
||||
int getZ();
|
||||
|
||||
// a < b
|
||||
bool operator<( ChunkFile *b );
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ File OldChunkStorage::getFile(int x, int z) {
|
|||
|
||||
wchar_t xRadix36[64];
|
||||
wchar_t zRadix36[64];
|
||||
#if (0 || 0 || 0 || \
|
||||
defined __linux__)
|
||||
#if defined(__linux__)
|
||||
assert(0); // need a gcc verison of _itow ?
|
||||
#else
|
||||
_itow(x, xRadix36, 36);
|
||||
|
|
@ -197,7 +196,7 @@ bool OldChunkStorage::saveEntities(LevelChunk* lc, Level* level,
|
|||
lc->lastSaveHadEntities = false;
|
||||
ListTag<CompoundTag>* entityTags = new ListTag<CompoundTag>();
|
||||
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
EnterCriticalRWSection(&lc->m_csEntities, true);
|
||||
#else
|
||||
EnterCriticalSection(&lc->m_csEntities);
|
||||
|
|
@ -215,7 +214,7 @@ bool OldChunkStorage::saveEntities(LevelChunk* lc, Level* level,
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
#if defined(_ENTITIES_RW_SECTION)
|
||||
LeaveCriticalRWSection(&lc->m_csEntities, true);
|
||||
#else
|
||||
LeaveCriticalSection(&lc->m_csEntities);
|
||||
|
|
@ -253,7 +252,7 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level,
|
|||
|
||||
PIXBeginNamedEvent(0, "Saving entities");
|
||||
CompoundTag* tag = new CompoundTag();
|
||||
#ifndef SPLIT_SAVES
|
||||
#if !defined(SPLIT_SAVES)
|
||||
saveEntities(lc, level, tag);
|
||||
#endif
|
||||
|
||||
|
|
@ -351,7 +350,7 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
|||
tag->putByteArray(L"Biomes", lc->getBiomes());
|
||||
|
||||
PIXBeginNamedEvent(0, "Saving entities");
|
||||
#ifndef SPLIT_SAVES
|
||||
#if !defined(SPLIT_SAVES)
|
||||
saveEntities(lc, level, tag);
|
||||
#endif
|
||||
|
||||
|
|
@ -457,7 +456,7 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
|||
levelChunk->terrainPopulated |= LevelChunk::sTerrainPostPostProcessed;
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
|
|
@ -563,35 +562,10 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) {
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// 4J - removed - we shouldn't need this any more
|
||||
if (!levelChunk->data->isValid())
|
||||
{
|
||||
levelChunk->data = new DataLayer(LevelChunk::BLOCKS_LENGTH, level->depthBits); // 4J - BLOCKS_LENGTH was levelChunk->blocks.length
|
||||
}
|
||||
#endif
|
||||
|
||||
// 4J removed - we shouldn't need this any more
|
||||
#if 0
|
||||
if (levelChunk->heightmap.data == NULL || !levelChunk->skyLight->isValid())
|
||||
{
|
||||
static int chunksUpdated = 0;
|
||||
delete [] levelChunk->heightmap.data;
|
||||
levelChunk->heightmap = byteArray(16 * 16);
|
||||
delete levelChunk->skyLight;
|
||||
levelChunk->skyLight = new DataLayer(levelChunk->blocks.length, level->depthBits);
|
||||
levelChunk->recalcHeightmap();
|
||||
}
|
||||
|
||||
if (!levelChunk->blockLight->isValid())
|
||||
{
|
||||
delete levelChunk->blockLight;
|
||||
levelChunk->blockLight = new DataLayer(levelChunk->blocks.length, level->depthBits);
|
||||
levelChunk->recalcBlockLights();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
|
|
|
|||
|
|
@ -70,13 +70,7 @@ bool PortalForcer::findPortal(std::shared_ptr<Entity> e, double xOriginal,
|
|||
if (level->dimension->id == -1) {
|
||||
r *= 3;
|
||||
} else {
|
||||
#if 0
|
||||
// AP poor little Vita takes 30 seconds to leave the Nether. This should
|
||||
// help
|
||||
r *= 5;
|
||||
#else
|
||||
r *= 8;
|
||||
#endif
|
||||
}
|
||||
double closest = -1;
|
||||
int xTarget = 0;
|
||||
|
|
|
|||
|
|
@ -72,19 +72,6 @@ int Region::getTile(int x, int y, int z) {
|
|||
int xc = (x >> 4);
|
||||
int zc = (z >> 4);
|
||||
|
||||
#if 0
|
||||
// AP - added a caching system for Chunk::rebuild to take advantage of
|
||||
if (CachedTiles && xc == xcCached && zc == zcCached) {
|
||||
unsigned char* Tiles = CachedTiles;
|
||||
Tiles += y;
|
||||
if (y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) {
|
||||
Tiles += Level::COMPRESSED_CHUNK_SECTION_TILES -
|
||||
Level::COMPRESSED_CHUNK_SECTION_HEIGHT;
|
||||
}
|
||||
|
||||
return Tiles[((x & 15) << 11) | ((z & 15) << 7)];
|
||||
}
|
||||
#endif
|
||||
|
||||
xc -= xc1;
|
||||
zc -= zc1;
|
||||
|
|
|
|||
|
|
@ -33,12 +33,7 @@ SparseDataStorage::SparseDataStorage() {
|
|||
// MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the
|
||||
// allocation later, and so free it with the corresponding call to
|
||||
// XPhysicalFree.
|
||||
#if 0
|
||||
unsigned char* planeIndices = (unsigned char*)XPhysicalAlloc(
|
||||
128 * 128, MAXULONG_PTR, 4096, PAGE_READWRITE);
|
||||
#else
|
||||
unsigned char* planeIndices = (unsigned char*)malloc(128 * 128);
|
||||
#endif
|
||||
unsigned char* data = planeIndices + 128;
|
||||
planeIndices[0] = ALL_0_INDEX;
|
||||
for (int i = 1; i < 128; i++) {
|
||||
|
|
@ -52,7 +47,7 @@ SparseDataStorage::SparseDataStorage() {
|
|||
dataAndCount =
|
||||
0x007F000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
|
||||
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
count = 128;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -74,7 +69,7 @@ SparseDataStorage::SparseDataStorage(bool isUpper) {
|
|||
dataAndCount =
|
||||
0x0000000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
|
||||
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
count = 128;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -85,11 +80,6 @@ SparseDataStorage::~SparseDataStorage() {
|
|||
// Determine correct means to free this data - could have been allocated
|
||||
// either with XPhysicalAlloc or malloc
|
||||
|
||||
#if 0
|
||||
if ((unsigned int)indicesAndData >= MM_PHYSICAL_4KB_BASE) {
|
||||
XPhysicalFree(indicesAndData);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
free(indicesAndData);
|
||||
}
|
||||
|
|
@ -118,7 +108,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage* copyFrom) {
|
|||
|
||||
XMemCpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128);
|
||||
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
count = sourceCount;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -432,7 +422,7 @@ void SparseDataStorage::addNewPlane(int y) {
|
|||
// Queue old data to be deleted
|
||||
queueForDelete(lastDataPointer);
|
||||
// printf("Marking for delete 0x%x\n", lastDataPointer);
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
count = linesUsed;
|
||||
#endif
|
||||
} else {
|
||||
|
|
@ -474,11 +464,6 @@ void SparseDataStorage::tick() {
|
|||
// if( toFree ) printf("Deleting 0x%x\n", toFree);
|
||||
// Determine correct means to free this data - could have been allocated either
|
||||
// with XPhysicalAlloc or malloc
|
||||
#if 0
|
||||
if ((unsigned int)toFree >= MM_PHYSICAL_4KB_BASE) {
|
||||
XPhysicalFree(toFree);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
free(toFree);
|
||||
}
|
||||
|
|
@ -515,7 +500,7 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) {
|
|||
}
|
||||
} while (!success);
|
||||
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
count = (newDataAndCount >> 48) & 0xffff;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -592,7 +577,7 @@ int SparseDataStorage::compress() {
|
|||
queueForDelete(planeIndices);
|
||||
// printf("Successfully compressed to %d planes, to delete
|
||||
//0x%x\n", planesToAlloc, planeIndices);
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
count = planesToAlloc;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__)
|
||||
#include "../../Platform/x64headers/xmcore.h"
|
||||
#endif // __linux__
|
||||
#endif
|
||||
|
||||
// 4J added - Storage for data (ie the extra per tile storage). Data is normally
|
||||
// stored as 4-bits per tile, in a DataLayer class of 16384 bytes ( 128 x 16 x
|
||||
|
|
@ -70,11 +70,6 @@ private:
|
|||
|
||||
static const int ALL_0_INDEX = 128;
|
||||
|
||||
#if 0
|
||||
static const unsigned int MM_PHYSICAL_4KB_BASE =
|
||||
0xE0000000; // Start of where 4KB page sized physical allocations are
|
||||
// made
|
||||
#endif
|
||||
public:
|
||||
SparseDataStorage();
|
||||
SparseDataStorage(bool isUpper);
|
||||
|
|
@ -119,7 +114,7 @@ public:
|
|||
static int deleteQueueIndex;
|
||||
static XLockFreeStack<unsigned char> deleteQueue[3];
|
||||
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
#if defined(DATA_COMPRESSION_STATS)
|
||||
int count;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -34,12 +34,7 @@ SparseLightStorage::SparseLightStorage(bool sky) {
|
|||
// MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the
|
||||
// allocation later, and so free it with the corresponding call to
|
||||
// XPhysicalFree.
|
||||
#if 0
|
||||
unsigned char* planeIndices = (unsigned char*)XPhysicalAlloc(
|
||||
128 * 128, MAXULONG_PTR, 4096, PAGE_READWRITE);
|
||||
#else
|
||||
unsigned char* planeIndices = (unsigned char*)malloc(128 * 128);
|
||||
#endif
|
||||
unsigned char* data = planeIndices + 128;
|
||||
planeIndices[127] = sky ? ALL_15_INDEX : ALL_0_INDEX;
|
||||
for (int i = 0; i < 127; i++) {
|
||||
|
|
@ -53,7 +48,7 @@ SparseLightStorage::SparseLightStorage(bool sky) {
|
|||
dataAndCount =
|
||||
0x007F000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
|
||||
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
count = 127;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -75,7 +70,7 @@ SparseLightStorage::SparseLightStorage(bool sky, bool isUpper) {
|
|||
dataAndCount =
|
||||
0x0000000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
|
||||
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
count = 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -86,11 +81,6 @@ SparseLightStorage::~SparseLightStorage() {
|
|||
// Determine correct means to free this data - could have been allocated
|
||||
// either with XPhysicalAlloc or malloc
|
||||
|
||||
#if 0
|
||||
if ((unsigned int)indicesAndData >= MM_PHYSICAL_4KB_BASE) {
|
||||
XPhysicalFree(indicesAndData);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
free(indicesAndData);
|
||||
}
|
||||
|
|
@ -119,7 +109,7 @@ SparseLightStorage::SparseLightStorage(SparseLightStorage* copyFrom) {
|
|||
|
||||
XMemCpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128);
|
||||
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
count = sourceCount;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -435,7 +425,7 @@ void SparseLightStorage::addNewPlane(int y) {
|
|||
// Queue old data to be deleted
|
||||
queueForDelete(lastDataPointer);
|
||||
// printf("Marking for delete 0x%x\n", lastDataPointer);
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
count = linesUsed;
|
||||
#endif
|
||||
} else {
|
||||
|
|
@ -477,11 +467,6 @@ void SparseLightStorage::tick() {
|
|||
// if( toFree ) printf("Deleting 0x%x\n", toFree);
|
||||
// Determine correct means to free this data - could have been allocated either
|
||||
// with XPhysicalAlloc or malloc
|
||||
#if 0
|
||||
if ((unsigned int)toFree >= MM_PHYSICAL_4KB_BASE) {
|
||||
XPhysicalFree(toFree);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
free(toFree);
|
||||
}
|
||||
|
|
@ -518,7 +503,7 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) {
|
|||
}
|
||||
} while (!success);
|
||||
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
count = (newDataAndCount >> 48) & 0xffff;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -602,7 +587,7 @@ int SparseLightStorage::compress() {
|
|||
queueForDelete(planeIndices);
|
||||
// printf("Successfully compressed to %d planes, to delete
|
||||
//0x%x\n", planesToAlloc, planeIndices);
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
count = planesToAlloc;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__)
|
||||
#include "../../Platform/x64headers/xmcore.h"
|
||||
#endif // __linux__
|
||||
#endif
|
||||
|
||||
// 4J added - Storage for block & sky light data. Lighting data is normally
|
||||
// stored as 4-bits per tile, in a DataLayer class of 16384 bytes ( 128 x 16 x
|
||||
|
|
@ -72,11 +72,6 @@ private:
|
|||
|
||||
static const int ALL_0_INDEX = 128;
|
||||
static const int ALL_15_INDEX = 129;
|
||||
#if 0
|
||||
static const unsigned int MM_PHYSICAL_4KB_BASE =
|
||||
0xE0000000; // Start of where 4KB page sized physical allocations are
|
||||
// made
|
||||
#endif
|
||||
public:
|
||||
SparseLightStorage(bool sky);
|
||||
SparseLightStorage(bool sky, bool isUpper);
|
||||
|
|
@ -119,7 +114,7 @@ public:
|
|||
static int deleteQueueIndex;
|
||||
static XLockFreeStack<unsigned char> deleteQueue[3];
|
||||
|
||||
#ifdef LIGHT_COMPRESSION_STATS
|
||||
#if defined(LIGHT_COMPRESSION_STATS)
|
||||
int count;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "../../Minecraft.Client/Platform/Common/ShutdownManager.h"
|
||||
|
||||
// This should always be enabled, except for debugging use
|
||||
#ifndef _DEBUG
|
||||
#if !defined(_DEBUG)
|
||||
#define CONNECTION_ENABLE_TIMEOUT_DISCONNECT 1
|
||||
#endif
|
||||
|
||||
|
|
@ -119,20 +119,6 @@ Connection::Connection(Socket* socket, const std::wstring& id,
|
|||
new C4JThread(runWrite, this, writeThreadName, WRITE_STACK_SIZE);
|
||||
readThread->SetProcessor(CPU_CORE_CONNECTIONS);
|
||||
writeThread->SetProcessor(CPU_CORE_CONNECTIONS);
|
||||
#if 0
|
||||
readThread->SetPriority(
|
||||
THREAD_PRIORITY_BELOW_NORMAL); // On Orbis, this core is also used for
|
||||
// Matching 2, and that priority of that
|
||||
// seems to be always at default no
|
||||
// matter what we set it to. Prioritise
|
||||
// this below Matching 2.
|
||||
writeThread->SetPriority(
|
||||
THREAD_PRIORITY_BELOW_NORMAL); // On Orbis, this core is also used for
|
||||
// Matching 2, and that priority of that
|
||||
// seems to be always at default no
|
||||
// matter what we set it to. Prioritise
|
||||
// this below Matching 2.
|
||||
#endif
|
||||
|
||||
readThread->Run();
|
||||
writeThread->Run();
|
||||
|
|
@ -209,12 +195,12 @@ bool Connection::writeTick() {
|
|||
LeaveCriticalSection(&writeLock);
|
||||
|
||||
Packet::writePacket(packet, bufferedDos);
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
bufferedDos->flush(); // Ensure buffered data reaches socket before any
|
||||
// other writes
|
||||
#endif
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
// 4J Added for debugging
|
||||
int playerId = 0;
|
||||
if (!socket->isLocal()) {
|
||||
|
|
@ -261,7 +247,7 @@ bool Connection::writeTick() {
|
|||
// write it to QNet as a single packet with priority flags Otherwise
|
||||
// just buffer the packet with other outgoing packets as the java game
|
||||
// did
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
// Linux fix: For local connections, always use bufferedDos to avoid
|
||||
// byte interleaving between the BufferedOutputStream buffer and direct
|
||||
// sos writes. The shouldDelay/writeWithFlags path writes directly to
|
||||
|
|
@ -278,11 +264,7 @@ bool Connection::writeTick() {
|
|||
// "game" packets to QNet, rather than amalgamated chunks of data
|
||||
// that may include many packets, and partial packets b) To be able
|
||||
// to change the priority and queue of a packet if required
|
||||
#if 0
|
||||
int flags = QNET_SENDDATA_LOW_PRIORITY | QNET_SENDDATA_SECONDARY;
|
||||
#else
|
||||
int flags = NON_QNET_SENDDATA_ACK_REQUIRED;
|
||||
#endif
|
||||
sos->writeWithFlags(baos->buf, 0, baos->size(), flags);
|
||||
baos->reset();
|
||||
} else {
|
||||
|
|
@ -291,7 +273,7 @@ bool Connection::writeTick() {
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
// 4J Added for debugging
|
||||
if (!socket->isLocal()) {
|
||||
int playerId = 0;
|
||||
|
|
@ -534,7 +516,6 @@ void Connection::sendAndQuit() {
|
|||
// multithreaded functions a bit more
|
||||
// readThread.interrupt();
|
||||
|
||||
#if 1
|
||||
// 4J - this used to be in a thread but not sure why, and is causing trouble
|
||||
// for us if we kill the connection whilst the thread is still expecting to
|
||||
// be able to send a packet a couple of seconds after starting it
|
||||
|
|
@ -542,9 +523,6 @@ void Connection::sendAndQuit() {
|
|||
// 4J TODO writeThread.interrupt();
|
||||
close(DisconnectPacket::eDisconnect_Closed);
|
||||
}
|
||||
#else
|
||||
CreateThread(NULL, 0, runSendAndQuit, this, 0, &saqThreadID);
|
||||
#endif
|
||||
}
|
||||
|
||||
int Connection::countDelayedPackets() { return (int)outgoing_slow.size(); }
|
||||
|
|
@ -554,9 +532,6 @@ int Connection::runRead(void* lpParam) {
|
|||
Connection* con = (Connection*)lpParam;
|
||||
|
||||
if (con == NULL) {
|
||||
#if 0
|
||||
ShutdownManager::HasFinished(ShutdownManager::eConnectionReadThreads);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,12 +64,7 @@ bool AwardStatPacket::isAync() { return true; }
|
|||
|
||||
// On most platforms we only store 'count' in an AwardStatPacket.
|
||||
int AwardStatPacket::getCount() {
|
||||
#if 0
|
||||
assert(false); // Method not supported on Durango.
|
||||
return 0;
|
||||
#else
|
||||
return *((int*)this->m_paramData.data);
|
||||
#endif
|
||||
}
|
||||
|
||||
// On Durango we store 'Event' parameters here in a blob.
|
||||
|
|
|
|||
|
|
@ -3,53 +3,4 @@
|
|||
#include "Packet.h"
|
||||
|
||||
class ChatAutoCompletePacket : public Packet {
|
||||
#if 0
|
||||
private String message;
|
||||
|
||||
public ChatAutoCompletePacket() {
|
||||
|
||||
}
|
||||
public ChatAutoCompletePacket(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream dis) throws IOException {
|
||||
message = readUtf(dis, ChatPacket.MAX_LENGTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dos) throws IOException {
|
||||
writeUtf(message, dos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener listener) {
|
||||
listener.handleChatAutoComplete(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEstimatedSize() {
|
||||
return 2 + message.length() * 2;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
return String.format("message='%s'", message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeInvalidated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalidatedBy(Packet packet) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -3,98 +3,4 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
|
||||
class ClientInformationPacket : public Packet {
|
||||
#if 0
|
||||
private String language;
|
||||
private int viewDistance;
|
||||
private int chatVisibility;
|
||||
private boolean chatColors;
|
||||
private int difficulty;
|
||||
|
||||
public ClientInformationPacket() {
|
||||
}
|
||||
|
||||
public ClientInformationPacket(String language, int viewDistance, int chatVisibility, boolean chatColors, int difficulty, boolean showCape) {
|
||||
this.language = language;
|
||||
this.viewDistance = viewDistance;
|
||||
this.chatVisibility = chatVisibility;
|
||||
this.chatColors = chatColors;
|
||||
this.difficulty = difficulty;
|
||||
this.showCape = showCape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream dis) throws IOException {
|
||||
language = readUtf(dis, 7);
|
||||
viewDistance = dis.readByte();
|
||||
|
||||
int chat = dis.readByte();
|
||||
chatVisibility = chat & 0x7;
|
||||
chatColors = (chat & 0x8) == 0x8;
|
||||
|
||||
difficulty = dis.readByte();
|
||||
showCape = dis.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dos) throws IOException {
|
||||
writeUtf(language, dos);
|
||||
dos.writeByte(viewDistance);
|
||||
dos.writeByte(chatVisibility | (chatColors ? 1 : 0) << 3);
|
||||
dos.writeByte(difficulty);
|
||||
dos.writeBoolean(showCape);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener listener) {
|
||||
listener.handleClientInformation(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEstimatedSize() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public int getViewDistance() {
|
||||
return viewDistance;
|
||||
}
|
||||
|
||||
public int getChatVisibility() {
|
||||
return chatVisibility;
|
||||
}
|
||||
|
||||
public boolean getChatColors() {
|
||||
return chatColors;
|
||||
}
|
||||
|
||||
public int getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public boolean getShowCape() {
|
||||
return showCape;
|
||||
}
|
||||
|
||||
public void setDifficulty(int difficulty) {
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
return String.format("lang='%s', view=%d, chat=%d, col=%b, difficulty=%d", language, viewDistance, chatVisibility, chatColors, difficulty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeInvalidated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalidatedBy(Packet packet) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -3,71 +3,4 @@
|
|||
#include "Packet.h"
|
||||
|
||||
class ClientProtocolPacket : public Packet {
|
||||
#if 0
|
||||
private int protocolVersion;
|
||||
private String userName;
|
||||
|
||||
// [EB]: Two fields below exist because we used to have a feature where we sent this
|
||||
// information so people with dynamic proxies know where to connect us to.
|
||||
private String hostName;
|
||||
private int port;
|
||||
|
||||
public ClientProtocolPacket() {
|
||||
// Needed
|
||||
}
|
||||
|
||||
public ClientProtocolPacket(final int protocolVersion, final String userName, final String hostName, final int port) {
|
||||
this.protocolVersion = protocolVersion;
|
||||
this.userName = userName;
|
||||
this.hostName = hostName;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream dis) throws IOException {
|
||||
protocolVersion = dis.readByte();
|
||||
userName = readUtf(dis, Player.MAX_NAME_LENGTH);
|
||||
hostName = readUtf(dis, 255);
|
||||
port = dis.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dos) throws IOException {
|
||||
dos.writeByte(protocolVersion);
|
||||
writeUtf(userName, dos);
|
||||
writeUtf(hostName, dos);
|
||||
dos.writeInt(port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener listener) {
|
||||
listener.handleClientProtocolPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEstimatedSize() {
|
||||
return 1 + 2 + 2 * userName.length();
|
||||
}
|
||||
|
||||
public int getProtocolVersion() {
|
||||
return protocolVersion;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
return String.format("ver=%d, name='%s'", protocolVersion, userName);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -33,20 +33,12 @@ public:
|
|||
eDisconnect_NoUGC_Single_Local,
|
||||
eDisconnect_ContentRestricted_AllLocal,
|
||||
eDisconnect_ContentRestricted_Single_Local,
|
||||
#if 1
|
||||
eDisconnect_NoUGC_Remote,
|
||||
#endif
|
||||
|
||||
eDisconnect_NoFriendsInGame,
|
||||
eDisconnect_Banned,
|
||||
eDisconnect_NotFriendsWithHost,
|
||||
eDisconnect_NATMismatch,
|
||||
#if 0
|
||||
eDisconnect_NetworkError,
|
||||
#endif
|
||||
#if 0
|
||||
eDisconnect_ExitedGame,
|
||||
#endif
|
||||
};
|
||||
|
||||
// 4J Stu - The reason was a string, but we need to send a non-locale
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "Packet.h"
|
||||
#include "../../Headers/com.mojang.nbt.h"
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#include "../../../Minecraft.Client/Minecraft.h"
|
||||
#include "../../../Minecraft.Client/UI/Gui.h"
|
||||
#endif
|
||||
|
|
@ -151,7 +151,7 @@ void Packet::staticCtor() {
|
|||
ContainerClosePacket::create);
|
||||
map(102, false, true, false, false, typeid(ContainerClickPacket),
|
||||
ContainerClickPacket::create);
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
// 4J Stu - We have some debug code that uses this packet to send data back
|
||||
// to the server from the client We may wish to add this into the real game
|
||||
// at some point
|
||||
|
|
@ -285,15 +285,11 @@ int Packet::renderPos = 0;
|
|||
void Packet::map(int id, bool receiveOnClient, bool receiveOnServer,
|
||||
bool sendToAnyClient, bool renderStats,
|
||||
const std::type_info& clazz, packetCreateFn createFn) {
|
||||
#if 0
|
||||
if (idToClassMap.count(id) > 0) throw new IllegalArgumentException(std::wstring(L"Duplicate packet id:") + _toString<int>(id));
|
||||
if (classToIdMap.count(clazz) > 0) throw new IllegalArgumentException(L"Duplicate packet class:"); // TODO + clazz);
|
||||
#endif
|
||||
|
||||
idToCreateMap.insert(
|
||||
std::unordered_map<int, packetCreateFn>::value_type(id, createFn));
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if PACKET_ENABLE_STAT_TRACKING
|
||||
Packet::PacketStatistics* packetStatistics = new PacketStatistics(id);
|
||||
outgoingStatistics[id] = packetStatistics;
|
||||
|
|
@ -318,16 +314,12 @@ void Packet::map(int id, bool receiveOnClient, bool receiveOnServer,
|
|||
// 4J Added to record data for outgoing packets
|
||||
void Packet::recordOutgoingPacket(std::shared_ptr<Packet> packet,
|
||||
int playerIndex) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if PACKET_ENABLE_STAT_TRACKING
|
||||
#if 0
|
||||
int idx = packet->getId();
|
||||
#else
|
||||
int idx = playerIndex;
|
||||
if (packet->getId() != 51) {
|
||||
idx = 100;
|
||||
}
|
||||
#endif
|
||||
AUTO_VAR(it, outgoingStatistics.find(idx));
|
||||
|
||||
if (it == outgoingStatistics.end()) {
|
||||
|
|
@ -342,7 +334,7 @@ void Packet::recordOutgoingPacket(std::shared_ptr<Packet> packet,
|
|||
}
|
||||
|
||||
void Packet::updatePacketStatsPIX() {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if PACKET_ENABLE_STAT_TRACKING
|
||||
|
||||
for (AUTO_VAR(it, outgoingStatistics.begin());
|
||||
|
|
@ -375,7 +367,7 @@ byteArray Packet::readBytes(DataInputStream* datainputstream) {
|
|||
int size = datainputstream->readShort();
|
||||
if (size < 0) {
|
||||
app.DebugPrintf("Key was smaller than nothing! Weird key!");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
__debugbreak();
|
||||
#endif
|
||||
return byteArray();
|
||||
|
|
@ -450,7 +442,7 @@ std::shared_ptr<Packet> Packet::readPacket(
|
|||
// 4J - Don't bother tracking stats in a content package
|
||||
// 4J Stu - This changes a bit in 1.0.1, but we don't really use it so stick
|
||||
// with what we have
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if PACKET_ENABLE_STAT_TRACKING
|
||||
AUTO_VAR(it, statistics.find(id));
|
||||
|
||||
|
|
@ -481,13 +473,6 @@ void Packet::writeUtf(const std::wstring& value,
|
|||
DataOutputStream* dos) // throws IOException TODO 4J JEV,
|
||||
// should this declare a throws?
|
||||
{
|
||||
#if 0
|
||||
#include <limits>
|
||||
if (value.length() > std::numeric_limits<short>::max())
|
||||
{
|
||||
throw new IOException(L"String too big");
|
||||
}
|
||||
#endif
|
||||
|
||||
dos->writeShort((short)value.length());
|
||||
dos->writeChars(value);
|
||||
|
|
|
|||
|
|
@ -3,55 +3,4 @@
|
|||
#include "Packet.h"
|
||||
|
||||
class ServerAuthDataPacket : public Packet {
|
||||
#if 0
|
||||
private String serverId;
|
||||
private PublicKey publicKey;
|
||||
private uint8_t[] nonce = new uint8_t[]{};
|
||||
|
||||
public ServerAuthDataPacket() {
|
||||
// Needed
|
||||
}
|
||||
|
||||
public ServerAuthDataPacket(final String serverId, final PublicKey publicKey, final uint8_t[] nonce) {
|
||||
this.serverId = serverId;
|
||||
this.publicKey = publicKey;
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream dis) throws IOException {
|
||||
serverId = readUtf(dis, 20);
|
||||
publicKey = Crypt.byteToPublicKey(readBytes(dis));
|
||||
nonce = readBytes(dis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dos) throws IOException {
|
||||
writeUtf(serverId, dos);
|
||||
writeBytes(dos, publicKey.getEncoded());
|
||||
writeBytes(dos, nonce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener listener) {
|
||||
listener.handleServerAuthData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEstimatedSize() {
|
||||
return 2 + serverId.length() * 2 + 2 + publicKey.getEncoded().length + 2 + nonce.length;
|
||||
}
|
||||
|
||||
public String getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public PublicKey getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public uint8_t[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -3,60 +3,4 @@
|
|||
#include "Packet.h"
|
||||
|
||||
class SharedKeyPacket : public Packet {
|
||||
#if 0
|
||||
private uint8_t[] keybytes = new uint8_t[]{};
|
||||
private uint8_t[] nonce = new uint8_t[]{};
|
||||
|
||||
private SecretKey secretKey;
|
||||
|
||||
public SharedKeyPacket() {
|
||||
// Needed
|
||||
}
|
||||
|
||||
public SharedKeyPacket(final SecretKey secretKey, final PublicKey publicKey, final uint8_t[] nonce) {
|
||||
this.secretKey = secretKey;
|
||||
this.keybytes = Crypt.encryptUsingKey(publicKey, secretKey.getEncoded());
|
||||
this.nonce = Crypt.encryptUsingKey(publicKey, nonce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream dis) throws IOException {
|
||||
keybytes = readBytes(dis);
|
||||
nonce = readBytes(dis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dos) throws IOException {
|
||||
writeBytes(dos, keybytes);
|
||||
writeBytes(dos, nonce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener listener) {
|
||||
listener.handleSharedKey(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEstimatedSize() {
|
||||
return 2 + keybytes.length + 2 + nonce.length;
|
||||
}
|
||||
|
||||
public SecretKey getSecretKey(PrivateKey privateKey) {
|
||||
if (privateKey == null) {
|
||||
return secretKey;
|
||||
}
|
||||
return secretKey = Crypt.decryptByteToSecretKey(privateKey, keybytes);
|
||||
}
|
||||
|
||||
public SecretKey getSecretKey() {
|
||||
return getSecretKey(null);
|
||||
}
|
||||
|
||||
public uint8_t[] getNonce(PrivateKey privateKey) {
|
||||
if (privateKey == null) {
|
||||
return nonce;
|
||||
}
|
||||
return Crypt.decryptUsingKey(privateKey, nonce);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -461,15 +461,9 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b,
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool lowPriority = ((flags & QNET_SENDDATA_LOW_PRIORITY) ==
|
||||
QNET_SENDDATA_LOW_PRIORITY);
|
||||
bool requireAck = lowPriority;
|
||||
#else
|
||||
bool lowPriority = false;
|
||||
bool requireAck = ((flags & NON_QNET_SENDDATA_ACK_REQUIRED) ==
|
||||
NON_QNET_SENDDATA_ACK_REQUIRED);
|
||||
#endif
|
||||
|
||||
if (m_queueIdx == SOCKET_SERVER_END) {
|
||||
// printf( "Sent %u bytes of data from \"%ls\" to \"%ls\"\n",
|
||||
|
|
|
|||
|
|
@ -17,11 +17,7 @@
|
|||
#include "Minecraft.World.h"
|
||||
#include "../../Minecraft.Client/Level/ServerLevel.h"
|
||||
|
||||
#if 0
|
||||
#include "../Stats/DurangoStats.h"
|
||||
#else
|
||||
#include "../Stats/CommonStats.h"
|
||||
#endif
|
||||
|
||||
void MinecraftWorld_RunStaticCtors() {
|
||||
// The ordering of these static ctors can be important. If they are within
|
||||
|
|
@ -42,12 +38,8 @@ void MinecraftWorld_RunStaticCtors() {
|
|||
Item::staticCtor();
|
||||
FurnaceRecipes::staticCtor();
|
||||
Recipes::staticCtor();
|
||||
#if 0
|
||||
GenericStats::setInstance(new DurangoStats());
|
||||
#else
|
||||
GenericStats::setInstance(new CommonStats());
|
||||
Stats::staticCtor();
|
||||
#endif
|
||||
// Achievements::staticCtor(); // 4J Stu - This is now called from
|
||||
// within the Stats::staticCtor()
|
||||
TileEntity::staticCtor();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include <sys/sys_time.h>
|
||||
#endif
|
||||
#include "System.h"
|
||||
#if defined(__linux__)
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
#endif // __linux__
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
void System::arraycopy(arrayWithLength<T> src, unsigned int srcPos,
|
||||
|
|
@ -70,7 +67,7 @@ int64_t System::nanoTime() {
|
|||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return static_cast<int64_t>(ts.tv_sec) * 1000000000LL + ts.tv_nsec;
|
||||
#endif // __linux__
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns the current time in milliseconds. Note that while the unit of time of
|
||||
|
|
@ -84,31 +81,7 @@ int64_t System::nanoTime() {
|
|||
// the difference, measured in milliseconds, between the current time and
|
||||
// midnight, January 1, 1970 UTC.
|
||||
int64_t System::currentTimeMillis() {
|
||||
#if 0
|
||||
// sys_time_get_current_time() obtains the elapsed time since Epoch
|
||||
//(1970/01/01 00:00:00 UTC). The value is separated into two parts: sec
|
||||
//stores the elapsed time in seconds, and nsec
|
||||
// stores the value that is smaller than a second in nanoseconds.
|
||||
sys_time_sec_t sec;
|
||||
sys_time_nsec_t nsec;
|
||||
sys_time_get_current_time(&sec, &nsec);
|
||||
int64_t msec = (sec * 1000) + (nsec / (1000 * 1000));
|
||||
return msec;
|
||||
|
||||
#elif 0
|
||||
SceRtcTick tick;
|
||||
int err = sceRtcGetCurrentTick(&tick);
|
||||
|
||||
return (int64_t)(tick.tick / 1000);
|
||||
#elif 0
|
||||
// AP - TRC states we can't use the RTC for measuring elapsed game time
|
||||
return sceKernelGetProcessTimeWide() / 1000;
|
||||
/* SceDateTime Time;
|
||||
sceRtcGetCurrentClockLocalTime(&Time);
|
||||
int64_t systTime = (((((((Time.day * 24) + Time.hour) * 60) +
|
||||
Time.minute) * 60) + Time.second) * 1000) + (Time.microsecond / 1000); return
|
||||
systTime;*/
|
||||
#elif defined(__linux__)
|
||||
#if defined(__linux__)
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
// Convert to milliseconds since unix epoch instead of windows file time
|
||||
|
|
@ -129,24 +102,13 @@ int64_t System::currentTimeMillis() {
|
|||
li.LowPart = UTCFileTime.dwLowDateTime;
|
||||
|
||||
return li.QuadPart / 10000;
|
||||
#endif // 0
|
||||
#endif
|
||||
}
|
||||
|
||||
// 4J Stu - Added this so that we can use real-world timestamps in PSVita saves.
|
||||
// Particularly required for the save transfers to be smooth
|
||||
int64_t System::currentRealTimeMillis() {
|
||||
#if 0
|
||||
SceDateTime Time;
|
||||
sceRtcGetCurrentClockLocalTime(&Time);
|
||||
int64_t systTime =
|
||||
(((((((Time.day * 24) + Time.hour) * 60) + Time.minute) * 60) +
|
||||
Time.second) *
|
||||
1000) +
|
||||
(Time.microsecond / 1000);
|
||||
return systTime;
|
||||
#else
|
||||
return currentTimeMillis();
|
||||
#endif
|
||||
}
|
||||
|
||||
void System::ReverseUSHORT(unsigned short* pusVal) {
|
||||
|
|
|
|||
|
|
@ -101,9 +101,6 @@ void Player::_init() {
|
|||
m_bCheckedForModelParts = false;
|
||||
m_bCheckedDLCForModelParts = false;
|
||||
|
||||
#if 0 || 0
|
||||
m_ePlayerNameValidState = ePlayerNameValid_NotSet;
|
||||
#endif
|
||||
|
||||
enderChestInventory = std::shared_ptr<PlayerEnderChestContainer>(
|
||||
new PlayerEnderChestContainer());
|
||||
|
|
@ -146,11 +143,9 @@ Player::Player(Level* level, const std::wstring& name) : LivingEntity(level) {
|
|||
app.GetGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false);
|
||||
m_bIsGuest = false;
|
||||
|
||||
#if 1
|
||||
// 4J: Set UUID to name on none-XB1 consoles, may change in future but for
|
||||
// now ownership of animals on these consoles is done by name
|
||||
setUUID(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
Player::~Player() {
|
||||
|
|
@ -335,36 +330,6 @@ void Player::tick() {
|
|||
if (!level->isClientSide) {
|
||||
static int count = 0;
|
||||
if (count++ == 100) {
|
||||
#if 0
|
||||
#ifdef _WINDOWS64
|
||||
// Drop some items so we have them in inventory to play with
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Tile::recordPlayer) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::map) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::record_01) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::record_02) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>(new ItemInstance( Item::pickAxe_diamond, 1 )) );
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// #ifdef _DEBUG
|
||||
// // Drop some items so we have them in inventory to play with
|
||||
// this->drop( shared_ptr<ItemInstance>( new ItemInstance(Tile::recordPlayer) ) );
|
||||
// this->drop( shared_ptr<ItemInstance>( new ItemInstance(Item::map) ) );
|
||||
// this->drop( shared_ptr<ItemInstance>( new ItemInstance(Item::record_01) ) );
|
||||
// this->drop( shared_ptr<ItemInstance>( new ItemInstance(Item::record_02) ) );
|
||||
// this->drop( shared_ptr<ItemInstance>(new ItemInstance( Item::pickAxe_diamond, 1 )) );
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Drop some items so we have them in inventory to play with
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Tile::recordPlayer) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::map) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::record_01) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance(Item::record_02) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>(new ItemInstance( Item::pickAxe_diamond, 1 )) );
|
||||
#endif
|
||||
#endif
|
||||
// 4J-PB - Throw items out at the start of the level
|
||||
// this->drop( new ItemInstance( Item::pickAxe_diamond, 1 ) );
|
||||
// this->drop( new ItemInstance( Tile::workBench, 1 ) );
|
||||
|
|
@ -429,76 +394,6 @@ void Player::tick() {
|
|||
// inventory.add(itemInstance);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// 4J Stu - This makes a tunnel with a powered track just over length to get the On A Rail achievement
|
||||
// It needs a few items at the start to get you going (a level and some powered rails) and of course a
|
||||
// minecart. For some reason some of the torches come off so it will also need some fixing along the way.
|
||||
static bool madeTrack = false;
|
||||
if( !madeTrack )
|
||||
{
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance( Item::minecart, 1 ) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance( Tile::goldenRail, 10 ) ) );
|
||||
this->drop( std::shared_ptr<ItemInstance>( new ItemInstance( Tile::lever, 10 ) ) );
|
||||
|
||||
int poweredCount = 0;
|
||||
for(int i = 10; i < 2800; ++i)
|
||||
{
|
||||
level->setTileAndData(x+i,y-1,z-2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y,z-2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+1,z-2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+2,z-2,Tile::glowstone_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+3,z-2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
|
||||
level->setTileAndData(x+i,y-1,z-1,Tile::stoneBrick_Id,0,Tile::UPDATE_CLIENTS);
|
||||
if(i%20 == 0)
|
||||
{
|
||||
level->setTileAndData(x+i,y,z-1,Tile::redstoneTorch_on_Id,0,Tile::UPDATE_CLIENTS);
|
||||
poweredCount = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
level->setTileAndData(x+i,y,z-1,0,0,Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
level->setTileAndData(x+i,y+1,z-1,0,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+2,z-1,0,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+3,z-1,0,0,Tile::UPDATE_CLIENTS);
|
||||
|
||||
level->setTileAndData(x+i,y-1,z,Tile::stoneBrick_Id,0,Tile::UPDATE_CLIENTS);
|
||||
if(poweredCount>0)
|
||||
{
|
||||
level->setTileAndData(x+i,y,z,Tile::goldenRail_Id,0,Tile::UPDATE_CLIENTS);
|
||||
--poweredCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
level->setTileAndData(x+i,y,z,Tile::rail_Id,0,Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
level->setTileAndData(x+i,y+1,z,0,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+2,z,0,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+3,z,0,0,Tile::UPDATE_CLIENTS);
|
||||
|
||||
level->setTileAndData(x+i,y-1,z+1,Tile::stoneBrick_Id,0,Tile::UPDATE_CLIENTS);
|
||||
if((i+5)%20 == 0)
|
||||
{
|
||||
level->setTileAndData(x+i,y,z+1,Tile::torch_Id,0,Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
level->setTileAndData(x+i,y,z+1,0,0,Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
level->setTileAndData(x+i,y+1,z+1,0,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+2,z+1,0,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+3,z+1,0,0,Tile::UPDATE_CLIENTS);
|
||||
|
||||
level->setTileAndData(x+i,y-1,z+2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y,z+2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+1,z+2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+2,z+2,Tile::glowstone_Id,0,Tile::UPDATE_CLIENTS);
|
||||
level->setTileAndData(x+i,y+3,z+2,Tile::quartzBlock_Id,0,Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
madeTrack = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// End 4J sTU
|
||||
}
|
||||
|
|
@ -594,14 +489,14 @@ void Player::ride(std::shared_ptr<Entity> e) {
|
|||
}
|
||||
|
||||
void Player::setPlayerDefaultSkin(EDefaultSkins skin) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"Setting default skin to %d for player %ls\n", skin, name.c_str());
|
||||
#endif
|
||||
m_skinIndex = skin;
|
||||
}
|
||||
|
||||
void Player::setCustomSkin(std::uint32_t skinId) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"Attempting to set skin to %08X for player %ls\n", skinId,
|
||||
name.c_str());
|
||||
#endif
|
||||
|
|
@ -721,17 +616,10 @@ unsigned int Player::getSkinAnimOverrideBitmask(std::uint32_t skinId) {
|
|||
|
||||
void Player::setXuid(PlayerUID xuid) {
|
||||
m_xuid = xuid;
|
||||
#if 0
|
||||
// 4J Stu - For XboxOne (and probably in the future all other platforms) we
|
||||
// store a UUID for the player to use as the owner key for tamed animals
|
||||
// This should just be a string version of the xuid
|
||||
|
||||
setUUID(xuid.toString());
|
||||
#endif
|
||||
}
|
||||
|
||||
void Player::setCustomCape(std::uint32_t capeId) {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"Attempting to set cape to %08X for player %s\n", capeId,
|
||||
name.c_str());
|
||||
#endif
|
||||
|
|
@ -1955,28 +1843,11 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) {
|
|||
// on durango.
|
||||
int dist = minecartAchievementPos->dist(
|
||||
Mth::floor(x), Mth::floor(y), Mth::floor(z));
|
||||
#if 0
|
||||
// 4J-PB - send the event to cause the progress bar to
|
||||
// increase on XB1
|
||||
if (m_bAwardedOnARail == false) {
|
||||
if (dist < 500) {
|
||||
if ((dist > 0) && (dist % 100 == 0)) {
|
||||
awardStat(GenericStats::onARail(),
|
||||
GenericStats::param_onARail(dist));
|
||||
}
|
||||
} else {
|
||||
awardStat(GenericStats::onARail(),
|
||||
GenericStats::param_onARail(dist));
|
||||
m_bAwardedOnARail = true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ((m_bAwardedOnARail == false) && (dist >= 500)) {
|
||||
awardStat(GenericStats::onARail(),
|
||||
GenericStats::param_onARail(dist));
|
||||
m_bAwardedOnARail = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} else if (riding->instanceof(eTYPE_BOAT)) {
|
||||
|
|
@ -2203,7 +2074,7 @@ void Player::startUsingItem(std::shared_ptr<ItemInstance> instance,
|
|||
GenericStats::param_itemsUsed(
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this()), instance));
|
||||
|
||||
#if (!0) && (defined _EXTENDED_ACHIEVEMENTS)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
if ((instance->getItem()->id == Item::rotten_flesh_Id) &&
|
||||
(getFoodData()->getFoodLevel() == 0))
|
||||
awardStat(GenericStats::ironBelly(), GenericStats::param_ironBelly());
|
||||
|
|
@ -2375,12 +2246,7 @@ int Player::getTexture() {
|
|||
|
||||
int Player::hash_fnct(const std::shared_ptr<Player> k) {
|
||||
// TODO 4J Stu - Should we just be using the pointers and hashing them?
|
||||
#if 0
|
||||
return (int)boost::hash_value(
|
||||
k->name); // 4J Stu - Names are completely unique?
|
||||
#else
|
||||
return (int)std::hash<std::wstring>()(k->name);
|
||||
#endif // 0
|
||||
}
|
||||
|
||||
bool Player::eq_test(const std::shared_ptr<Player> x,
|
||||
|
|
@ -2815,17 +2681,3 @@ void Player::SetAdditionalModelParts(
|
|||
m_ppAdditionalModelParts = ppAdditionalModelParts;
|
||||
}
|
||||
|
||||
#if 0 || 0
|
||||
|
||||
Player::ePlayerNameValidState Player::GetPlayerNameValidState(void) {
|
||||
return m_ePlayerNameValidState;
|
||||
}
|
||||
|
||||
void Player::SetPlayerNameValidState(bool bState) {
|
||||
if (bState) {
|
||||
m_ePlayerNameValidState = ePlayerNameValid_True;
|
||||
} else {
|
||||
m_ePlayerNameValidState = ePlayerNameValid_False;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -582,27 +582,11 @@ public:
|
|||
void SetAdditionalModelParts(
|
||||
std::vector<ModelPart*>* ppAdditionalModelParts);
|
||||
|
||||
#if 0 || 0
|
||||
enum ePlayerNameValidState {
|
||||
ePlayerNameValid_NotSet = 0,
|
||||
ePlayerNameValid_True,
|
||||
ePlayerNameValid_False
|
||||
};
|
||||
|
||||
ePlayerNameValidState GetPlayerNameValidState();
|
||||
void SetPlayerNameValidState(bool bState);
|
||||
#endif
|
||||
private:
|
||||
std::vector<ModelPart*>* m_ppAdditionalModelParts;
|
||||
bool m_bCheckedForModelParts;
|
||||
bool m_bCheckedDLCForModelParts;
|
||||
|
||||
#if 0 || 0
|
||||
ePlayerNameValidState
|
||||
m_ePlayerNameValidState; // 4J-PB - to ensure we have the characters
|
||||
// for this name in our font, or display a
|
||||
// player number instead
|
||||
#endif
|
||||
};
|
||||
|
||||
struct PlayerKeyHash {
|
||||
|
|
|
|||
|
|
@ -144,41 +144,6 @@ void ArmorDyeRecipe::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {
|
|||
memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9);
|
||||
ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9);
|
||||
|
||||
#if 0
|
||||
AUTO_VAR(citEnd, ingredients->end());
|
||||
|
||||
for (std::vector<ItemInstance *>::const_iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++)
|
||||
{
|
||||
ItemInstance *expected = *ingredient;
|
||||
|
||||
if (expected!=NULL)
|
||||
{
|
||||
int iAuxVal = (*ingredient)->getAuxValue();
|
||||
TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24;
|
||||
// 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them in a 2x2 crafting screen
|
||||
if(iCount==2) iCount=3;
|
||||
bFound=false;
|
||||
for(j=0;j<TempIngReq.iIngC;j++)
|
||||
{
|
||||
if((TempIngReq.iIngIDA[j]==expected->id) && (iAuxVal == Recipes::ANY_AUX_VALUE || TempIngReq.iIngAuxValA[j] == iAuxVal))
|
||||
{
|
||||
bFound= true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bFound)
|
||||
{
|
||||
TempIngReq.iIngValA[j]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
TempIngReq.iIngIDA[TempIngReq.iIngC]=expected->id;
|
||||
TempIngReq.iIngAuxValA[TempIngReq.iIngC]=iAuxVal;
|
||||
TempIngReq.iIngValA[TempIngReq.iIngC++]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pIngReq->iIngIDA = new int[TempIngReq.iIngC];
|
||||
pIngReq->iIngValA = new int[TempIngReq.iIngC];
|
||||
|
|
|
|||
|
|
@ -20,20 +20,6 @@ void ClothDyeRecipes::addRecipes(Recipes* r) {
|
|||
new ItemInstance(Tile::clayHardened), L'X',
|
||||
new ItemInstance(Item::dye_powder, 1, i), L'D');
|
||||
|
||||
#if 0
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stained_glass, 8, ColoredTile::getItemAuxValueForTileData(i)), //
|
||||
L"sssczczg",
|
||||
L"###",
|
||||
L"#X#",
|
||||
L"###",
|
||||
L'#', new ItemInstance(Tile::glass),
|
||||
L'X', new ItemInstance(Item::dye_powder, 1, i), L'D');
|
||||
r->addShapedRecipy(new ItemInstance(Tile::stained_glass_pane, 16, i), //
|
||||
L"ssczg",
|
||||
L"###",
|
||||
L"###",
|
||||
L'#', new ItemInstance(Tile::stained_glass, 1, i), L'D');
|
||||
#endif
|
||||
}
|
||||
|
||||
// some dye recipes
|
||||
|
|
|
|||
|
|
@ -6,20 +6,6 @@ class Objective;
|
|||
class Score {
|
||||
public:
|
||||
// 4J Not converted
|
||||
#if 0
|
||||
static final Comparator<Score> SCORE_COMPARATOR = new Comparator<Score>() {
|
||||
@Override
|
||||
public int compare(Score o1, Score o2) {
|
||||
if (o1.getScore() > o2.getScore()) {
|
||||
return 1;
|
||||
} else if (o1.getScore() < o2.getScore()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
private:
|
||||
Scoreboard* scoreboard;
|
||||
|
|
|
|||
|
|
@ -1,189 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
// 4J Not converted
|
||||
#if 0
|
||||
class ScoreboardSaveData extends SavedData {
|
||||
public static final String FILE_ID = "scoreboard";
|
||||
|
||||
private Scoreboard scoreboard;
|
||||
private CompoundTag delayLoad;
|
||||
|
||||
public ScoreboardSaveData() {
|
||||
this(FILE_ID);
|
||||
}
|
||||
|
||||
public ScoreboardSaveData(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public void setScoreboard(Scoreboard scoreboard) {
|
||||
this.scoreboard = scoreboard;
|
||||
|
||||
if (delayLoad != null) {
|
||||
load(delayLoad);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag tag) {
|
||||
if (scoreboard == null) {
|
||||
delayLoad = tag;
|
||||
return;
|
||||
}
|
||||
|
||||
loadObjectives((ListTag<CompoundTag>) tag.getList("Objectives"));
|
||||
loadPlayerScores((ListTag<CompoundTag>) tag.getList("PlayerScores"));
|
||||
|
||||
if (tag.contains("DisplaySlots")) {
|
||||
loadDisplaySlots(tag.getCompound("DisplaySlots"));
|
||||
}
|
||||
|
||||
if (tag.contains("Teams")) {
|
||||
loadTeams((ListTag<CompoundTag>) tag.getList("Teams"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadTeams(ListTag<CompoundTag> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CompoundTag tag = list.get(i);
|
||||
|
||||
PlayerTeam team = scoreboard.addPlayerTeam(tag.getString("Name"));
|
||||
team.setDisplayName(tag.getString("DisplayName"));
|
||||
team.setPrefix(tag.getString("Prefix"));
|
||||
team.setSuffix(tag.getString("Suffix"));
|
||||
if (tag.contains("AllowFriendlyFire")) team.setAllowFriendlyFire(tag.getBoolean("AllowFriendlyFire"));
|
||||
if (tag.contains("SeeFriendlyInvisibles")) team.setSeeFriendlyInvisibles(tag.getBoolean("SeeFriendlyInvisibles"));
|
||||
|
||||
loadTeamPlayers(team, (ListTag<StringTag>) tag.getList("Players"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadTeamPlayers(PlayerTeam team, ListTag<StringTag> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
scoreboard.addPlayerToTeam(list.get(i).data, team);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadDisplaySlots(CompoundTag tag) {
|
||||
for (int i = 0; i < Scoreboard.DISPLAY_SLOTS; i++) {
|
||||
if (tag.contains("slot_" + i)) {
|
||||
String name = tag.getString("slot_" + i);
|
||||
Objective objective = scoreboard.getObjective(name);
|
||||
scoreboard.setDisplayObjective(i, objective);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadObjectives(ListTag<CompoundTag> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CompoundTag tag = list.get(i);
|
||||
|
||||
ObjectiveCriteria criteria = ObjectiveCriteria.CRITERIA_BY_NAME.get(tag.getString("CriteriaName"));
|
||||
Objective objective = scoreboard.addObjective(tag.getString("Name"), criteria);
|
||||
objective.setDisplayName(tag.getString("DisplayName"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadPlayerScores(ListTag<CompoundTag> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CompoundTag tag = list.get(i);
|
||||
|
||||
Objective objective = scoreboard.getObjective(tag.getString("Objective"));
|
||||
Score score = scoreboard.getPlayerScore(tag.getString("Name"), objective);
|
||||
score.setScore(tag.getInt("Score"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(CompoundTag tag) {
|
||||
if (scoreboard == null) {
|
||||
MinecraftServer.getInstance().getLogger().warning("Tried to save scoreboard without having a scoreboard...");
|
||||
return;
|
||||
}
|
||||
|
||||
tag.put("Objectives", saveObjectives());
|
||||
tag.put("PlayerScores", savePlayerScores());
|
||||
tag.put("Teams", saveTeams());
|
||||
|
||||
saveDisplaySlots(tag);
|
||||
}
|
||||
|
||||
protected ListTag<CompoundTag> saveTeams() {
|
||||
ListTag<CompoundTag> list = new ListTag<CompoundTag>();
|
||||
Collection<PlayerTeam> teams = scoreboard.getPlayerTeams();
|
||||
|
||||
for (PlayerTeam team : teams) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
|
||||
tag.putString("Name", team.getName());
|
||||
tag.putString("DisplayName", team.getDisplayName());
|
||||
tag.putString("Prefix", team.getPrefix());
|
||||
tag.putString("Suffix", team.getSuffix());
|
||||
tag.putBoolean("AllowFriendlyFire", team.isAllowFriendlyFire());
|
||||
tag.putBoolean("SeeFriendlyInvisibles", team.canSeeFriendlyInvisibles());
|
||||
|
||||
ListTag<StringTag> playerList = new ListTag<StringTag>();
|
||||
|
||||
for (String player : team.getPlayers()) {
|
||||
playerList.add(new StringTag("", player));
|
||||
}
|
||||
|
||||
tag.put("Players", playerList);
|
||||
|
||||
list.add(tag);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected void saveDisplaySlots(CompoundTag tag) {
|
||||
CompoundTag slots = new CompoundTag();
|
||||
boolean hasDisplaySlot = false;
|
||||
|
||||
for (int i = 0; i < Scoreboard.DISPLAY_SLOTS; i++) {
|
||||
Objective objective = scoreboard.getDisplayObjective(i);
|
||||
|
||||
if (objective != null) {
|
||||
slots.putString("slot_" + i, objective.getName());
|
||||
hasDisplaySlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDisplaySlot) tag.putCompound("DisplaySlots", slots);
|
||||
}
|
||||
|
||||
protected ListTag<CompoundTag> saveObjectives() {
|
||||
ListTag<CompoundTag> list = new ListTag<CompoundTag>();
|
||||
Collection<Objective> objectives = scoreboard.getObjectives();
|
||||
|
||||
for (Objective objective : objectives) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
|
||||
tag.putString("Name", objective.getName());
|
||||
tag.putString("CriteriaName", objective.getCriteria().getName());
|
||||
tag.putString("DisplayName", objective.getDisplayName());
|
||||
|
||||
list.add(tag);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected ListTag<CompoundTag> savePlayerScores() {
|
||||
ListTag<CompoundTag> list = new ListTag<CompoundTag>();
|
||||
Collection<Score> scores = scoreboard.getScores();
|
||||
|
||||
for (Score score : scores) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
|
||||
tag.putString("Name", score.getOwner());
|
||||
tag.putString("Objective", score.getObjective().getName());
|
||||
tag.putInt("Score", score.getScore());
|
||||
|
||||
list.add(tag);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
@ -61,7 +61,7 @@ Achievement* Achievements::arrowKillCreeper = NULL;
|
|||
Achievement* Achievements::mine100Blocks = NULL;
|
||||
Achievement* Achievements::kill10Creepers = NULL;
|
||||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
Achievement* Achievements::overkill = NULL; // Restored old achivements.
|
||||
Achievement* Achievements::bookcase = NULL; // Restored old achivements.
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ void Achievements::staticCtor() {
|
|||
Tile::treeTrunk, (Achievement*)buildSword))
|
||||
->setAwardLocallyOnly()
|
||||
->postConstruct();
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
Achievements::eatPorkChop =
|
||||
(new Achievement(eAward_eatPorkChop, L"eatPorkChop", 0, 0,
|
||||
Tile::treeTrunk, (Achievement*)buildSword))
|
||||
|
|
@ -219,7 +219,6 @@ void Achievements::staticCtor() {
|
|||
Tile::treeTrunk, (Achievement*)buildSword))
|
||||
->postConstruct();
|
||||
|
||||
#if 1
|
||||
// WARNING: NO NEW ACHIEVMENTS CAN BE ADDED HERE
|
||||
// These stats (achievements) are directly followed by new
|
||||
// stats/achievements in the profile data, so cannot be changed without
|
||||
|
|
@ -278,9 +277,8 @@ void Achievements::staticCtor() {
|
|||
// = (new Achievement(eAward_bookcase,
|
||||
// L"bookcase", -3, 6, Tile::bookshelf,
|
||||
// (Achievement *)enchantments) )->postConstruct();
|
||||
#endif
|
||||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
Achievements::overkill =
|
||||
(new Achievement(eAward_overkill, L"overkill", -4, 1,
|
||||
Item::sword_diamond, (Achievement*)enchantments))
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ Stat* CommonStats::get_totalBlocksMined() { return Stats::totalBlocksMined; }
|
|||
Stat* CommonStats::get_timePlayed() { return Stats::timePlayed; }
|
||||
|
||||
Stat* CommonStats::get_blocksPlaced(int blockId) {
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return Stats::blocksPlaced[blockId];
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -98,7 +98,7 @@ Stat* CommonStats::get_itemsCollected(int itemId, int itemAux) {
|
|||
// 4J-JEV: We don't need itemsCollected(emerald) so I'm using it to
|
||||
// stor itemsBought(emerald) so I don't have to make yet another massive
|
||||
// StatArray for Items Bought.
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
if (itemId == Tile::wool_Id) return Stats::rainbowCollection[itemAux];
|
||||
#endif
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ Stat* CommonStats::get_itemsSmelted(int itemId) {
|
|||
}
|
||||
|
||||
Stat* CommonStats::get_itemsUsed(int itemId) {
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
// 4J-JEV: I've done the same thing here, we can't place these items anyway.
|
||||
if (itemId == Item::porkChop_cooked_Id) return Stats::blocksPlaced[itemId];
|
||||
#endif
|
||||
|
|
@ -141,7 +141,7 @@ Stat* CommonStats::get_killsEnderdragon() { return Stats::killsEnderdragon; }
|
|||
Stat* CommonStats::get_completeTheEnd() { return Stats::completeTheEnd; }
|
||||
|
||||
Stat* CommonStats::get_enteredBiome(int biomeId) {
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return Stats::biomesVisisted[biomeId];
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -203,7 +203,6 @@ Stat* CommonStats::get_achievement(eAward achievementId) {
|
|||
case eAward_socialPost:
|
||||
return (Stat*)Achievements::socialPost;
|
||||
|
||||
#if 1
|
||||
case eAward_snipeSkeleton:
|
||||
return (Stat*)Achievements::snipeSkeleton;
|
||||
case eAward_diamonds:
|
||||
|
|
@ -222,9 +221,8 @@ Stat* CommonStats::get_achievement(eAward achievementId) {
|
|||
return (Stat*)Achievements::winGame;
|
||||
case eAward_enchantments:
|
||||
return (Stat*)Achievements::enchantments;
|
||||
#endif
|
||||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
case eAward_overkill:
|
||||
return (Stat*)Achievements::overkill; // Restored old ach.
|
||||
case eAward_bookcase:
|
||||
|
|
|
|||
|
|
@ -151,71 +151,39 @@ Stat* GenericStats::flyPig() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::snipeSkeleton() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_snipeSkeleton);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::diamonds() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_diamonds);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::ghast() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_ghast);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::blazeRod() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_blazeRod);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::potion() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_potion);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::theEnd() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_theEnd);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::winGame() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_winGame);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::enchantments() {
|
||||
#if 1
|
||||
return instance->get_achievement(eAward_enchantments);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Stat* GenericStats::overkill() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_overkill);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -223,7 +191,7 @@ Stat* GenericStats::overkill() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::bookcase() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_bookcase);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -271,7 +239,7 @@ Stat* GenericStats::kill10Creepers() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::adventuringTime() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_adventuringTime);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -279,7 +247,7 @@ Stat* GenericStats::adventuringTime() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::repopulation() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_repopulation);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -287,7 +255,7 @@ Stat* GenericStats::repopulation() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::porkChop() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_eatPorkChop);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -295,7 +263,7 @@ Stat* GenericStats::porkChop() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::diamondsToYou() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_diamondsToYou);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -303,7 +271,7 @@ Stat* GenericStats::diamondsToYou() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::passingTheTime() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_play100Days);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -311,7 +279,7 @@ Stat* GenericStats::passingTheTime() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::archer() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_arrowKillCreeper);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -319,7 +287,7 @@ Stat* GenericStats::archer() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::theHaggler() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_theHaggler);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -327,7 +295,7 @@ Stat* GenericStats::theHaggler() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::potPlanter() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_potPlanter);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -335,7 +303,7 @@ Stat* GenericStats::potPlanter() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::itsASign() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_itsASign);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -343,7 +311,7 @@ Stat* GenericStats::itsASign() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::ironBelly() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_ironBelly);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -351,7 +319,7 @@ Stat* GenericStats::ironBelly() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::haveAShearfulDay() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_haveAShearfulDay);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -359,7 +327,7 @@ Stat* GenericStats::haveAShearfulDay() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::rainbowCollection() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_rainbowCollection);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -367,7 +335,7 @@ Stat* GenericStats::rainbowCollection() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::stayinFrosty() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_stayinFrosty);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -375,7 +343,7 @@ Stat* GenericStats::stayinFrosty() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::chestfulOfCobblestone() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_chestfulOfCobblestone);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -383,7 +351,7 @@ Stat* GenericStats::chestfulOfCobblestone() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::renewableEnergy() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_renewableEnergy);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -391,7 +359,7 @@ Stat* GenericStats::renewableEnergy() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::musicToMyEars() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_musicToMyEars);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -399,7 +367,7 @@ Stat* GenericStats::musicToMyEars() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::bodyGuard() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_bodyGuard);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -407,7 +375,7 @@ Stat* GenericStats::bodyGuard() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::ironMan() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_ironMan);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -415,7 +383,7 @@ Stat* GenericStats::ironMan() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::zombieDoctor() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_zombieDoctor);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -423,7 +391,7 @@ Stat* GenericStats::zombieDoctor() {
|
|||
}
|
||||
|
||||
Stat* GenericStats::lionTamer() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->get_achievement(eAward_lionTamer);
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -536,11 +504,7 @@ byteArray GenericStats::getParam_onARail(int distance) {
|
|||
}
|
||||
|
||||
byteArray GenericStats::getParam_overkill(int damage) {
|
||||
#if 0
|
||||
return getParam_noArgs();
|
||||
#else
|
||||
return getParam_achievement(eAward_overkill);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::getParam_openInventory(int menuId) {
|
||||
|
|
@ -548,7 +512,7 @@ byteArray GenericStats::getParam_openInventory(int menuId) {
|
|||
}
|
||||
|
||||
byteArray GenericStats::getParam_chestfulOfCobblestone(int cobbleStone) {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return getParam_achievement(eAward_chestfulOfCobblestone);
|
||||
#else
|
||||
return getParam_noArgs();
|
||||
|
|
@ -556,7 +520,7 @@ byteArray GenericStats::getParam_chestfulOfCobblestone(int cobbleStone) {
|
|||
}
|
||||
|
||||
byteArray GenericStats::getParam_musicToMyEars(int recordId) {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return getParam_achievement(eAward_musicToMyEars);
|
||||
#else
|
||||
return getParam_noArgs();
|
||||
|
|
@ -739,67 +703,35 @@ byteArray GenericStats::param_flyPig() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_snipeSkeleton() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_snipeSkeleton);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_diamonds() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_diamonds);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_ghast() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_ghast);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_blazeRod() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_blazeRod);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_potion() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_potion);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_theEnd() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_theEnd);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_winGame() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_winGame);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_enchantments() {
|
||||
#if 0
|
||||
return instance->getParam_noArgs();
|
||||
#else
|
||||
return instance->getParam_achievement(eAward_enchantments);
|
||||
#endif
|
||||
}
|
||||
|
||||
byteArray GenericStats::param_overkill(int dmg) {
|
||||
|
|
@ -807,7 +739,7 @@ byteArray GenericStats::param_overkill(int dmg) {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_bookcase() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_bookcase);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -855,7 +787,7 @@ byteArray GenericStats::param_kill10Creepers() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_adventuringTime() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_adventuringTime);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -863,7 +795,7 @@ byteArray GenericStats::param_adventuringTime() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_repopulation() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_repopulation);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -871,7 +803,7 @@ byteArray GenericStats::param_repopulation() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_porkChop() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_eatPorkChop);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -879,7 +811,7 @@ byteArray GenericStats::param_porkChop() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_diamondsToYou() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_diamondsToYou);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -887,7 +819,7 @@ byteArray GenericStats::param_diamondsToYou() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_passingTheTime() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_play100Days);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -895,7 +827,7 @@ byteArray GenericStats::param_passingTheTime() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_archer() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_arrowKillCreeper);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -903,7 +835,7 @@ byteArray GenericStats::param_archer() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_theHaggler() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_theHaggler);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -911,7 +843,7 @@ byteArray GenericStats::param_theHaggler() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_potPlanter() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_potPlanter);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -919,7 +851,7 @@ byteArray GenericStats::param_potPlanter() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_itsASign() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_itsASign);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -927,7 +859,7 @@ byteArray GenericStats::param_itsASign() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_ironBelly() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_ironBelly);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -935,7 +867,7 @@ byteArray GenericStats::param_ironBelly() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_haveAShearfulDay() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_haveAShearfulDay);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -943,7 +875,7 @@ byteArray GenericStats::param_haveAShearfulDay() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_rainbowCollection() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_rainbowCollection);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -951,7 +883,7 @@ byteArray GenericStats::param_rainbowCollection() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_stayinFrosty() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_stayinFrosty);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -963,7 +895,7 @@ byteArray GenericStats::param_chestfulOfCobblestone(int cobbleStone) {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_renewableEnergy() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_renewableEnergy);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -975,7 +907,7 @@ byteArray GenericStats::param_musicToMyEars(int recordId) {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_bodyGuard() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_bodyGuard);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -983,7 +915,7 @@ byteArray GenericStats::param_bodyGuard() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_ironMan() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_ironMan);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -991,7 +923,7 @@ byteArray GenericStats::param_ironMan() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_zombieDoctor() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_zombieDoctor);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
@ -999,7 +931,7 @@ byteArray GenericStats::param_zombieDoctor() {
|
|||
}
|
||||
|
||||
byteArray GenericStats::param_lionTamer() {
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
return instance->getParam_achievement(eAward_lionTamer);
|
||||
#else
|
||||
return instance->getParam_noArgs();
|
||||
|
|
|
|||
|
|
@ -39,12 +39,7 @@ Stat* Stat::postConstruct() {
|
|||
Stats::all->push_back(this);
|
||||
|
||||
std::pair<int, Stat*> id1(id, this);
|
||||
#if 0
|
||||
Stats::statsById->emplace(id1); // assert(0); // MGH - TODO - FIX - find
|
||||
// out where this move function comes from
|
||||
#else
|
||||
Stats::statsById->emplace(std::move(id1));
|
||||
#endif // 0
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ std::vector<ItemStat*>* Stats::blocksMinedStats = new std::vector<ItemStat*>;
|
|||
std::vector<ItemStat*>* Stats::itemsCollectedStats = new std::vector<ItemStat*>;
|
||||
std::vector<ItemStat*>* Stats::itemsCraftedStats = new std::vector<ItemStat*>;
|
||||
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
std::vector<ItemStat*>* Stats::blocksPlacedStats = new std::vector<ItemStat*>;
|
||||
#endif
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ StatArray Stats::blocksMined;
|
|||
StatArray Stats::itemsCollected;
|
||||
StatArray Stats::itemsCrafted;
|
||||
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
StatArray Stats::blocksPlaced;
|
||||
StatArray Stats::rainbowCollection;
|
||||
StatArray Stats::biomesVisisted;
|
||||
|
|
@ -327,23 +327,6 @@ void Stats::buildCraftableStats() {
|
|||
blocksMinedStats->push_back(newStat);
|
||||
blocksMined[Tile::reeds_Id] = newStat;
|
||||
newStat->postConstruct();
|
||||
#if 0
|
||||
newStat = new ItemStat(ITEMS_COLLECTED_OFFSET + 1, L"collectItem.wheat", Item::wheat->id);
|
||||
itemsCollectedStats->push_back(newStat);
|
||||
itemsCollected[Item::wheat->id] = newStat;
|
||||
newStat->postConstruct();
|
||||
|
||||
newStat = new ItemStat(ITEMS_COLLECTED_OFFSET + 2, L"collectItem.mushroom", Tile::mushroom1->id);
|
||||
itemsCollectedStats->push_back(newStat);
|
||||
itemsCollected[Tile::mushroom1->id] = newStat;
|
||||
itemsCollected[Tile::mushroom2->id] = newStat;
|
||||
newStat->postConstruct();
|
||||
|
||||
newStat = new ItemStat(ITEMS_COLLECTED_OFFSET + 3, L"collectItem.sugarCane", Item::reeds->id);
|
||||
itemsCollectedStats->push_back(newStat);
|
||||
itemsCollected[Item::reeds->id] = newStat;
|
||||
newStat->postConstruct();
|
||||
#endif
|
||||
|
||||
newStat = new ItemStat(ITEMS_COLLECTED_OFFSET + 4, L"collectItem.pumpkin",
|
||||
Tile::pumpkin->id);
|
||||
|
|
@ -577,7 +560,7 @@ void Stats::buildAdditionalStats() {
|
|||
Stats::completeTheEnd =
|
||||
(new GeneralStat(offset++, L"stat.completeTheEnd"))->postConstruct();
|
||||
|
||||
#if (defined _EXTENDED_ACHIEVEMENTS) && (!0)
|
||||
#if defined(_EXTENDED_ACHIEVEMENTS)
|
||||
{
|
||||
ItemStat* itemStat =
|
||||
new ItemStat(offset++, L"craftItem.flowerPot", Item::flowerPot_Id);
|
||||
|
|
|
|||
|
|
@ -16,11 +16,7 @@ enum ByteOrder {
|
|||
BIGENDIAN,
|
||||
LITTLEENDIAN,
|
||||
|
||||
#if 0 || 0
|
||||
LOCALSYTEM_ENDIAN = BIGENDIAN,
|
||||
#else
|
||||
LOCALSYTEM_ENDIAN = LITTLEENDIAN,
|
||||
#endif
|
||||
};
|
||||
enum EDefaultSkins {
|
||||
eDefaultSkins_ServerSelected,
|
||||
|
|
|
|||
|
|
@ -1,16 +1 @@
|
|||
#pragma once
|
||||
#if 0
|
||||
//
|
||||
namespace std {
|
||||
namespace tr1 {
|
||||
|
||||
template <class T>
|
||||
class hash<std::shared_ptr<T> > {
|
||||
public:
|
||||
std::size_t operator()(const std::shared_ptr<T>& key) const {
|
||||
return (std::size_t)key.get();
|
||||
}
|
||||
};
|
||||
} // namespace tr1
|
||||
} // namespace std
|
||||
#endif
|
||||
|
|
@ -5,15 +5,9 @@
|
|||
Language* I18n::lang = Language::getInstance();
|
||||
// 4jcraft const & into va_start is ub
|
||||
std::wstring I18n::get(std::wstring id, ...) {
|
||||
#if 0 // 4J - vita doesn't like having a reference type as the last
|
||||
// parameter passed to va_start - we shouldn't need this
|
||||
// method anyway
|
||||
return L"";
|
||||
#else
|
||||
va_list va;
|
||||
va_start(va, id);
|
||||
return I18n::get(id, va);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring I18n::get(const std::wstring& id, va_list args) {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ public:
|
|||
static const int IS_GRASS_SIDE = 1;
|
||||
static const int IS_GRASS_TOP = 2;
|
||||
|
||||
#if 0
|
||||
// AP - alpha cut out is expensive on vita so we mark which icons require it
|
||||
static const int IS_ALPHA_CUT_OUT = 4;
|
||||
#endif
|
||||
|
||||
virtual ~Icon() {} // added by 4jcraft, needed for abstract class
|
||||
|
||||
|
|
|
|||
|
|
@ -79,17 +79,11 @@ std::wstring Language::getElement(const std::wstring& elementId)
|
|||
|
||||
// 4jcraft changed, again const reference into va_start, std forbids
|
||||
std::wstring Language::getElement(std::wstring elementId, ...) {
|
||||
#if 0 // 4J - vita doesn't like having a reference type as the last
|
||||
// parameter passed to va_start - we shouldn't need this
|
||||
// method anyway
|
||||
return L"";
|
||||
#else
|
||||
va_list args;
|
||||
va_start(args, elementId);
|
||||
std::wstring result = getElement(elementId, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring Language::getElement(const std::wstring& elementId, va_list args) {
|
||||
|
|
|
|||
|
|
@ -14,25 +14,6 @@ std::wstring SharedConstants::readAcceptableChars() {
|
|||
L"0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'"
|
||||
L"abcdefghijklmnopqrstuvwxyz{|}~"
|
||||
L" ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»ã";
|
||||
#if 0 // 4J - do we actually really need to get this from a file?
|
||||
// try {
|
||||
// BufferedReader br = new BufferedReader(new
|
||||
// InputStreamReader(SharedConstants.class.getResourceAsStream("/font.txt"),
|
||||
// "UTF-8"));
|
||||
BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( new File( std::wstring(L"/font.txt") ) ) ) );
|
||||
std::wstring line;
|
||||
while ( !(line = br->readLine()).empty())
|
||||
{
|
||||
if (!( wcscmp( &line[0], L"#") == 0 ) )
|
||||
{
|
||||
result.append( line );
|
||||
}
|
||||
}
|
||||
br->close();
|
||||
//} catch (Exception e) {
|
||||
// TODO 4J Stu - Exception handling?
|
||||
//}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,10 +82,6 @@ enum eSOUND_TYPE {
|
|||
eSoundType_AMBIENT_WEATHER_RAIN,
|
||||
eSoundType_AMBIENT_WEATHER_THUNDER,
|
||||
eSoundType_AMBIENT_CAVE_CAVE,
|
||||
#if 0
|
||||
eSoundType_AMBIENT_CAVE_CAVE2, //- fixed version of eSoundType_CAVE_CAVE,
|
||||
// without the two 192k sounds
|
||||
#endif
|
||||
eSoundType_PORTAL_PORTAL,
|
||||
// 4J-PB - adding some that were still text in the code
|
||||
eSoundType_PORTAL_TRIGGER,
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ const char* wstringtofilename(const std::wstring& name) {
|
|||
assert(name.length() < 256);
|
||||
for (unsigned int i = 0; i < name.length(); i++) {
|
||||
wchar_t c = name[i];
|
||||
#if 0 || 0 || defined __linux__
|
||||
#if defined(__linux__)
|
||||
if (c == '\\') c = '/';
|
||||
#else
|
||||
if (c == '/') c = '\\';
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ typedef struct tagTHREADNAME_INFO {
|
|||
} THREADNAME_INFO;
|
||||
|
||||
void SetThreadName(std::uint32_t threadId, const char* threadName) {
|
||||
#if 1
|
||||
THREADNAME_INFO info;
|
||||
|
||||
info.dwType = 0x1000;
|
||||
|
|
@ -27,14 +26,4 @@ void SetThreadName(std::uint32_t threadId, const char* threadName) {
|
|||
: EXCEPTION_EXECUTE_HANDLER) {
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
__try {
|
||||
RaiseException(
|
||||
0x406D1388, 0, sizeof(info) / sizeof(std::uint32_t),
|
||||
reinterpret_cast<std::uint32_t*>(&info));
|
||||
} __except (GetExceptionCode() == 0x406D1388 ? EXCEPTION_CONTINUE_EXECUTION
|
||||
: EXCEPTION_EXECUTE_HANDLER) {
|
||||
}
|
||||
#endif
|
||||
#endif // 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void BiomeSource::getRawBiomeBlock(BiomeArray& biomes, int x, int z, int w,
|
|||
intArray result = layer->getArea(x, z, w, h);
|
||||
for (int i = 0; i < w * h; i++) {
|
||||
biomes[i] = Biome::biomes[result[i]];
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (biomes[i] == NULL) {
|
||||
app.DebugPrintf("Tried to assign null biome %d\n", result[i]);
|
||||
__debugbreak();
|
||||
|
|
@ -351,14 +351,7 @@ void BiomeSource::update() { cache->update(); }
|
|||
// #define DEBUG_SEEDS 50
|
||||
|
||||
// 4J added - find a seed for this biomesource that matches certain criteria
|
||||
#if 0
|
||||
int64_t BiomeSource::findSeed(
|
||||
LevelType* generator,
|
||||
bool* pServerRunning) // MGH - added pRunning, so we can early out of this
|
||||
// on Vita as it can take up to 60 secs
|
||||
#else
|
||||
int64_t BiomeSource::findSeed(LevelType* generator)
|
||||
#endif
|
||||
{
|
||||
|
||||
int64_t bestSeed = 0;
|
||||
|
|
@ -366,7 +359,7 @@ int64_t BiomeSource::findSeed(LevelType* generator)
|
|||
ProgressRenderer* mcprogress = Minecraft::GetInstance()->progressRenderer;
|
||||
mcprogress->progressStage(IDS_PROGRESS_NEW_WORLD_SEED);
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
|
|
@ -374,7 +367,7 @@ int64_t BiomeSource::findSeed(LevelType* generator)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef DEBUG_SEEDS
|
||||
#if defined(DEBUG_SEEDS)
|
||||
for (int k = 0; k < DEBUG_SEEDS; k++)
|
||||
#endif
|
||||
{
|
||||
|
|
@ -418,17 +411,13 @@ int64_t BiomeSource::findSeed(LevelType* generator)
|
|||
tryCount++;
|
||||
|
||||
mcprogress->progressStagePercentage(tryCount % 100);
|
||||
#if 0
|
||||
} while (!matchFound && *pServerRunning);
|
||||
#else
|
||||
} while (!matchFound);
|
||||
#endif
|
||||
|
||||
// Clean up
|
||||
delete pr;
|
||||
delete[] indices.data;
|
||||
|
||||
#ifdef DEBUG_SEEDS
|
||||
#if defined(DEBUG_SEEDS)
|
||||
app.DebugPrintf("%d: %d tries taken, seed used is %lld\n", k,
|
||||
tryCount, bestSeed);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,15 +36,7 @@ private:
|
|||
static bool getIsMatch(float* frac); // 4J added
|
||||
static void getFracs(intArray indices, float* fracs); // 4J added
|
||||
public:
|
||||
#if 0
|
||||
static int64_t findSeed(
|
||||
LevelType* generator,
|
||||
bool* pServerRunning); // MGH - added pRunning, so we can early out of
|
||||
// this on Vita as it can take up to 60 secs
|
||||
// // 4J added
|
||||
#else
|
||||
static int64_t findSeed(LevelType* generator); // 4J added
|
||||
#endif
|
||||
virtual ~BiomeSource();
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -46,93 +46,11 @@ void FlatGeneratorInfo::updateLayers() {
|
|||
|
||||
std::wstring FlatGeneratorInfo::toString() {
|
||||
return L"";
|
||||
#if 0
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(SERIALIZATION_VERSION);
|
||||
builder.append(";");
|
||||
|
||||
for (int i = 0; i < layers.size(); i++)
|
||||
{
|
||||
if (i > 0) builder.append(",");
|
||||
builder.append(layers.get(i).toString());
|
||||
}
|
||||
|
||||
builder.append(";");
|
||||
builder.append(biome);
|
||||
|
||||
if (!structures.isEmpty())
|
||||
{
|
||||
builder.append(";");
|
||||
int structCount = 0;
|
||||
|
||||
for (Map.Entry<String, Map<String, String>> structure : structures.entrySet())
|
||||
{
|
||||
if (structCount++ > 0) builder.append(",");
|
||||
builder.append(structure.getKey().toLowerCase());
|
||||
|
||||
Map<String, String> options = structure.getValue();
|
||||
if (!options.isEmpty())
|
||||
{
|
||||
builder.append("(");
|
||||
int optionCount = 0;
|
||||
|
||||
for (Map.Entry<String, String> option : options.entrySet())
|
||||
{
|
||||
if (optionCount++ > 0) builder.append(" ");
|
||||
builder.append(option.getKey());
|
||||
builder.append("=");
|
||||
builder.append(option.getValue());
|
||||
}
|
||||
|
||||
builder.append(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.append(";");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
#endif
|
||||
}
|
||||
|
||||
FlatLayerInfo* FlatGeneratorInfo::getLayerFromString(const std::wstring& input,
|
||||
int yOffset) {
|
||||
return NULL;
|
||||
#if 0
|
||||
std::vector<std::wstring> parts = stringSplit(input, L'x');
|
||||
|
||||
int height = 1;
|
||||
int id;
|
||||
int data = 0;
|
||||
|
||||
if (parts.size() == 2)
|
||||
{
|
||||
height = _fromString<int>(parts[0]);
|
||||
if (yOffset + height >= Level::maxBuildHeight) height = Level::maxBuildHeight - yOffset;
|
||||
if (height < 0) height = 0;
|
||||
}
|
||||
|
||||
std::wstring identity = parts[parts.size() - 1];
|
||||
parts = stringSplit(identity, L':');
|
||||
|
||||
id = _fromString<int>(parts[0]);
|
||||
if (parts.size() > 1) data = _from_String<int>(parts[1]);
|
||||
|
||||
if (Tile::tiles[id] == NULL)
|
||||
{
|
||||
id = 0;
|
||||
data = 0;
|
||||
}
|
||||
|
||||
if (data < 0 || data > 15) data = 0;
|
||||
|
||||
FlatLayerInfo *result = new FlatLayerInfo(height, id, data);
|
||||
result->setStart(yOffset);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<FlatLayerInfo*>* FlatGeneratorInfo::getLayersFromString(
|
||||
|
|
@ -157,65 +75,6 @@ std::vector<FlatLayerInfo*>* FlatGeneratorInfo::getLayersFromString(
|
|||
FlatGeneratorInfo* FlatGeneratorInfo::fromValue(const std::wstring& input) {
|
||||
return getDefault();
|
||||
|
||||
#if 0
|
||||
if (input.empty()) return getDefault();
|
||||
std::vector<std::wstring> parts = stringSplit(input, L';');
|
||||
|
||||
int version = parts.size() == 1 ? 0 : Mth::getInt(parts[0], 0);
|
||||
if (version < 0 || version > SERIALIZATION_VERSION) return getDefault();
|
||||
|
||||
FlatGeneratorInfo *result = new FlatGeneratorInfo();
|
||||
int index = parts.size() == 1 ? 0 : 1;
|
||||
std::vector<FlatLayerInfo *> *layers = getLayersFromString(parts[index++]);
|
||||
|
||||
if (layers == NULL || layers->isEmpty())
|
||||
{
|
||||
delete layers;
|
||||
return getDefault();
|
||||
}
|
||||
|
||||
result->getLayers()->addAll(layers);
|
||||
delete layers;
|
||||
result->updateLayers();
|
||||
|
||||
int biome = Biome::plains_Id;
|
||||
if (version > 0 && parts.size() > index) biome = Mth::getInt(parts[index++], biome);
|
||||
result->setBiome(biome);
|
||||
|
||||
if (version > 0 && parts.size() > index)
|
||||
{
|
||||
std::vector<std::wstring> structures = stringSplit(parts[index++], L',');
|
||||
|
||||
for(AUTO_VAR(it, structures.begin()); it != structures.end(); ++it)
|
||||
{
|
||||
std::vector<std::wstring> separated = stringSplit(parts[index++], L"\\(");
|
||||
|
||||
std::unordered_map<std::wstring, std::wstring> structureOptions;
|
||||
|
||||
if (separated[0].length() > 0)
|
||||
{
|
||||
(*result->getStructures())[separated[0]] = structureOptions;
|
||||
|
||||
if (separated.size() > 1 && separated[1].endsWith(L")") && separated[1].length() > 1)
|
||||
{
|
||||
String[] options = separated[1].substring(0, separated[1].length() - 1).split(" ");
|
||||
|
||||
for (int option = 0; option < options.length; option++)
|
||||
{
|
||||
String[] split = options[option].split("=", 2);
|
||||
if (split.length == 2) structureOptions[split[0]] = split[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(* (result->getStructures()) )[STRUCTURE_VILLAGE] = std::unordered_map<std::wstring, std::wstring>();
|
||||
}
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
FlatGeneratorInfo* FlatGeneratorInfo::getDefault() {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) {
|
||||
m_biomeOverride = byteArray(width * height);
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined(_UNICODE)
|
||||
std::wstring path = L"GAME:\\GameRules\\biomemap.bin";
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
#ifdef _WINDOWS64
|
||||
#if defined(_WINDOWS64)
|
||||
std::string path = "GameRules\\biomemap.bin";
|
||||
#else
|
||||
std::string path = "GAME:\\GameRules\\biomemap.bin";
|
||||
|
|
@ -27,12 +27,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) {
|
|||
|
||||
memset(m_biomeOverride.data, Biome::plains->id, m_biomeOverride.length);
|
||||
} else {
|
||||
#if 0
|
||||
__debugbreak(); // TODO
|
||||
DWORD bytesRead, dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead, dwFileSize = GetFileSize(file, NULL);
|
||||
#endif
|
||||
if (dwFileSize > m_biomeOverride.length) {
|
||||
app.DebugPrintf("Biomemap binary is too large!!\n");
|
||||
__debugbreak();
|
||||
|
|
|
|||
|
|
@ -3,18 +3,6 @@
|
|||
#include "../../Headers/net.minecraft.world.level.h"
|
||||
#include "BiomeOverrideLayer.h"
|
||||
|
||||
#if 0
|
||||
// AP - this is used to perform fast 64bit divides of known values
|
||||
#include "../../Util/libdivide.h"
|
||||
|
||||
libdivide::divider<long long> fast_d2(2);
|
||||
libdivide::divider<long long> fast_d3(3);
|
||||
libdivide::divider<long long> fast_d4(4);
|
||||
libdivide::divider<long long> fast_d5(5);
|
||||
libdivide::divider<long long> fast_d6(6);
|
||||
libdivide::divider<long long> fast_d7(7);
|
||||
libdivide::divider<long long> fast_d10(10);
|
||||
#endif
|
||||
|
||||
LayerArray Layer::getDefaultLayers(int64_t seed, LevelType* levelType) {
|
||||
// 4J - Some changes moved here from 1.2.3. Temperature & downfall layers
|
||||
|
|
@ -101,8 +89,8 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType* levelType) {
|
|||
biomeLayer = std::shared_ptr<Layer>(
|
||||
new RiverMixerLayer(100, biomeLayer, riverLayer));
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#ifdef _BIOME_OVERRIDE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
#if defined(_BIOME_OVERRIDE)
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
|
|
@ -172,38 +160,8 @@ void Layer::initRandom(int64_t x, int64_t y) {
|
|||
}
|
||||
|
||||
int Layer::nextRandom(int max) {
|
||||
#if 0
|
||||
// AP - 64bit mods are very slow on Vita. Replaced with a divide/mult for
|
||||
// general case and a fast divide library for specific numbers todo - this
|
||||
// can sometimes yield a different number to the original. There's a strange
|
||||
// bug sometimes with Vita where if the line "result = (int) ((rval >> 24) %
|
||||
// max);" is done twice in a row 'result' will not be the same. Need to
|
||||
// speak to Sony about that Also need to compare level against a different
|
||||
// platform using the same seed
|
||||
int result;
|
||||
long long temp = rval;
|
||||
temp >>= 24;
|
||||
if (max == 2) {
|
||||
result = temp - (temp / fast_d2) * 2;
|
||||
} else if (max == 3) {
|
||||
result = temp - (temp / fast_d3) * 3;
|
||||
} else if (max == 4) {
|
||||
result = temp - (temp / fast_d4) * 4;
|
||||
} else if (max == 5) {
|
||||
result = temp - (temp / fast_d5) * 5;
|
||||
} else if (max == 6) {
|
||||
result = temp - (temp / fast_d6) * 6;
|
||||
} else if (max == 7) {
|
||||
result = temp - (temp / fast_d7) * 7;
|
||||
} else if (max == 10) {
|
||||
result = temp - (temp / fast_d10) * 10;
|
||||
} else {
|
||||
result = temp - (temp / max) * max;
|
||||
}
|
||||
#else
|
||||
|
||||
int result = (int)((rval >> 24) % max);
|
||||
#endif
|
||||
|
||||
if (result < 0) result += max;
|
||||
// 4jcraft added cast to unsigned
|
||||
|
|
|
|||
Loading…
Reference in a new issue