diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 17:39:35 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 17:39:35 +0700 |
| commit | b9a2951901dac21b08589c9d8b4a7eae78757726 (patch) | |
| tree | 6b750cbdde9d2bd2aeaec9880ac7db62e9356745 /Minecraft.World | |
| parent | 119bff351450ea16ffda550b6e0f67379b29f708 (diff) | |
Revert "Get rid of MSVC's __int64"
This reverts commit d63f79325f85e014361eb8cf1e41eaebedb1ae71.
Diffstat (limited to 'Minecraft.World')
155 files changed, 834 insertions, 832 deletions
diff --git a/Minecraft.World/AddIslandLayer.cpp b/Minecraft.World/AddIslandLayer.cpp index a8842936..21e9a96d 100644 --- a/Minecraft.World/AddIslandLayer.cpp +++ b/Minecraft.World/AddIslandLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "net.minecraft.world.level.biome.h" -AddIslandLayer::AddIslandLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +AddIslandLayer::AddIslandLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/AddIslandLayer.h b/Minecraft.World/AddIslandLayer.h index 2446bbf8..e7c9384b 100644 --- a/Minecraft.World/AddIslandLayer.h +++ b/Minecraft.World/AddIslandLayer.h @@ -5,7 +5,7 @@ class AddIslandLayer : public Layer { public: - AddIslandLayer(int64_t seedMixup, shared_ptr<Layer>parent); + AddIslandLayer(__int64 seedMixup, shared_ptr<Layer>parent); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/AddMushroomIslandLayer.cpp b/Minecraft.World/AddMushroomIslandLayer.cpp index 324c88ee..022a3b29 100644 --- a/Minecraft.World/AddMushroomIslandLayer.cpp +++ b/Minecraft.World/AddMushroomIslandLayer.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.biome.h" -AddMushroomIslandLayer::AddMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup) +AddMushroomIslandLayer::AddMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/AddMushroomIslandLayer.h b/Minecraft.World/AddMushroomIslandLayer.h index f691ebda..acda9fa7 100644 --- a/Minecraft.World/AddMushroomIslandLayer.h +++ b/Minecraft.World/AddMushroomIslandLayer.h @@ -4,6 +4,6 @@ class AddMushroomIslandLayer : public Layer { public: - AddMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent); + AddMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent); virtual intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/AddSnowLayer.cpp b/Minecraft.World/AddSnowLayer.cpp index aa459789..d8a33cc9 100644 --- a/Minecraft.World/AddSnowLayer.cpp +++ b/Minecraft.World/AddSnowLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "net.minecraft.world.level.biome.h" -AddSnowLayer::AddSnowLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup) +AddSnowLayer::AddSnowLayer(__int64 seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/AddSnowLayer.h b/Minecraft.World/AddSnowLayer.h index 0b3702da..ede7a226 100644 --- a/Minecraft.World/AddSnowLayer.h +++ b/Minecraft.World/AddSnowLayer.h @@ -4,6 +4,6 @@ class AddSnowLayer : public Layer { public: - AddSnowLayer(int64_t seedMixup, shared_ptr<Layer> parent); + AddSnowLayer(__int64 seedMixup, shared_ptr<Layer> parent); virtual intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/BasicTree.cpp b/Minecraft.World/BasicTree.cpp index c1c92287..01f10cb3 100644 --- a/Minecraft.World/BasicTree.cpp +++ b/Minecraft.World/BasicTree.cpp @@ -524,7 +524,7 @@ bool BasicTree::place(Level *level, Random *random, int x, int y, int z) // Initialize the instance fields for the level and the seed. thisLevel = level; - int64_t seed = random->nextLong(); + __int64 seed = random->nextLong(); rnd->setSeed(seed); // Initialize the origin of the tree trunk origin[0] = x; diff --git a/Minecraft.World/BasicTypeContainers.h b/Minecraft.World/BasicTypeContainers.h index 8a139e3e..094e9616 100644 --- a/Minecraft.World/BasicTypeContainers.h +++ b/Minecraft.World/BasicTypeContainers.h @@ -57,14 +57,14 @@ public: } static bool isInfinite( double a ) { return false; /*4J TODO*/ } - static double longBitsToDouble( int64_t bits ) + static double longBitsToDouble( __int64 bits ) { return *(double *)&bits; } - static int64_t doubleToLongBits( double d ) + static __int64 doubleToLongBits( double d ) { - return *(int64_t *)&d; + return *(__int64 *)&d; } }; diff --git a/Minecraft.World/BiomeCache.cpp b/Minecraft.World/BiomeCache.cpp index 3ef4f0f6..0d9c017c 100644 --- a/Minecraft.World/BiomeCache.cpp +++ b/Minecraft.World/BiomeCache.cpp @@ -85,7 +85,7 @@ BiomeCache::Block *BiomeCache::getBlockAt(int x, int z) EnterCriticalSection(&m_CS); x >>= ZONE_SIZE_BITS; z >>= ZONE_SIZE_BITS; - int64_t slot = (((int64_t) x) & 0xffffffffl) | ((((int64_t) z) & 0xffffffffl) << 32l); + __int64 slot = (((__int64) x) & 0xffffffffl) | ((((__int64) z) & 0xffffffffl) << 32l); AUTO_VAR(it, cached.find(slot)); Block *block = NULL; if (it == cached.end()) @@ -124,8 +124,8 @@ float BiomeCache::getDownfall(int x, int z) void BiomeCache::update() { EnterCriticalSection(&m_CS); - int64_t now = app.getAppTime(); - int64_t utime = now - lastUpdateTime; + __int64 now = app.getAppTime(); + __int64 utime = now - lastUpdateTime; if (utime > DECAY_TIME / 4 || utime < 0) { lastUpdateTime = now; @@ -133,11 +133,11 @@ void BiomeCache::update() for (AUTO_VAR(it, all.begin()); it != all.end();) { Block *block = *it; - int64_t time = now - block->lastUse; + __int64 time = now - block->lastUse; if (time > DECAY_TIME || time < 0) { it = all.erase(it); - int64_t slot = (((int64_t) block->x) & 0xffffffffl) | ((((int64_t) block->z) & 0xffffffffl) << 32l); + __int64 slot = (((__int64) block->x) & 0xffffffffl) | ((((__int64) block->z) & 0xffffffffl) << 32l); cached.erase(slot); delete block; } diff --git a/Minecraft.World/BiomeCache.h b/Minecraft.World/BiomeCache.h index b2593ce3..bf509f54 100644 --- a/Minecraft.World/BiomeCache.h +++ b/Minecraft.World/BiomeCache.h @@ -10,7 +10,7 @@ private: static const int ZONE_SIZE_MASK = ZONE_SIZE - 1; const BiomeSource *source; - int64_t lastUpdateTime; + __int64 lastUpdateTime; public: class Block @@ -22,7 +22,7 @@ public: // BiomeArray biomes; byteArray biomeIndices; int x, z; - int64_t lastUse; + __int64 lastUse; Block(int x, int z, BiomeCache *parent); ~Block(); @@ -32,7 +32,7 @@ public: }; private: - unordered_map<int64_t,Block *,LongKeyHash,LongKeyEq> cached; // 4J - was LongHashMap + unordered_map<__int64,Block *,LongKeyHash,LongKeyEq> cached; // 4J - was LongHashMap vector<Block *> all; // was ArrayList<Block> public: diff --git a/Minecraft.World/BiomeInitLayer.cpp b/Minecraft.World/BiomeInitLayer.cpp index 6edd18de..ead63eee 100644 --- a/Minecraft.World/BiomeInitLayer.cpp +++ b/Minecraft.World/BiomeInitLayer.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.level.h" #include "BiomeInitLayer.h" -BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptr<Layer>parent, LevelType *levelType) : Layer(seed) +BiomeInitLayer::BiomeInitLayer(__int64 seed, shared_ptr<Layer>parent, LevelType *levelType) : Layer(seed) { this->parent = parent; diff --git a/Minecraft.World/BiomeInitLayer.h b/Minecraft.World/BiomeInitLayer.h index 00bf3812..e645a379 100644 --- a/Minecraft.World/BiomeInitLayer.h +++ b/Minecraft.World/BiomeInitLayer.h @@ -10,7 +10,7 @@ private: BiomeArray startBiomes; public: - BiomeInitLayer(int64_t seed, shared_ptr<Layer> parent, LevelType *levelType); + BiomeInitLayer(__int64 seed, shared_ptr<Layer> parent, LevelType *levelType); virtual ~BiomeInitLayer(); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index 9f03cc15..b16efd31 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -10,10 +10,10 @@ // 4J - removal of separate temperature & downfall layers brought forward from 1.2.3 void BiomeSource::_init() -{ +{ layer = nullptr; zoomedLayer = nullptr; - + cache = new BiomeCache(this); playerSpawnBiomes.push_back(Biome::forest); @@ -26,7 +26,7 @@ void BiomeSource::_init() playerSpawnBiomes.push_back(Biome::jungleHills); } -void BiomeSource::_init(int64_t seed, LevelType *generator) +void BiomeSource::_init(__int64 seed, LevelType *generator) { _init(); @@ -43,7 +43,7 @@ BiomeSource::BiomeSource() } // 4J added -BiomeSource::BiomeSource(int64_t seed, LevelType *generator) +BiomeSource::BiomeSource(__int64 seed, LevelType *generator) { _init(seed, generator); } @@ -271,7 +271,7 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int /** * Checks if an area around a block contains only the specified biomes. * Useful for placing elements like towns. -* +* * This is a bit of a rough check, to make it as fast as possible. To ensure * NO other biomes, add a margin of at least four blocks to the radius */ @@ -298,7 +298,7 @@ bool BiomeSource::containsOnly(int x, int z, int r, vector<Biome *> allowed) /** * Checks if an area around a block contains only the specified biome. * Useful for placing elements like towns. -* +* * This is a bit of a rough check, to make it as fast as possible. To ensure * NO other biomes, add a margin of at least four blocks to the radius */ @@ -308,7 +308,7 @@ bool BiomeSource::containsOnly(int x, int z, int r, Biome *allowed) int z0 = ((z - r) >> 2); int x1 = ((x + r) >> 2); int z1 = ((z + r) >> 2); - + int w = x1 - x0; int h = z1 - z0; int biomesCount = w*h; @@ -325,7 +325,7 @@ bool BiomeSource::containsOnly(int x, int z, int r, Biome *allowed) /** * Finds the specified biome within the radius. This will return a random * position if several are found. This test is fairly rough. -* +* * Returns null if the biome wasn't found */ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *random) @@ -362,7 +362,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand /** * Finds one of the specified biomes within the radius. This will return a * random position if several are found. This test is fairly rough. -* +* * Returns null if the biome wasn't found */ TilePos *BiomeSource::findBiome(int x, int z, int r, vector<Biome *> allowed, Random *random) @@ -408,13 +408,13 @@ void BiomeSource::update() // 4J added - find a seed for this biomesource that matches certain criteria #ifdef __PSVITA__ -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 +__int64 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) +__int64 BiomeSource::findSeed(LevelType *generator) #endif { - int64_t bestSeed = 0; + __int64 bestSeed = 0; ProgressRenderer *mcprogress = Minecraft::GetInstance()->progressRenderer; mcprogress->progressStage(IDS_PROGRESS_NEW_WORLD_SEED); @@ -452,7 +452,7 @@ int64_t BiomeSource::findSeed(LevelType *generator) // Just keeping trying to generate seeds until we find one that matches our criteria do { - int64_t seed = pr->nextLong(); + __int64 seed = pr->nextLong(); BiomeSource *biomeSource = new BiomeSource(seed,generator); biomeSource->getRawBiomeIndices(indices, biomeOffset, biomeOffset, biomeWidth, biomeWidth); @@ -484,7 +484,7 @@ int64_t BiomeSource::findSeed(LevelType *generator) unsigned int *pixels = new unsigned int[54 * 16 * 54 * 16]; for(int i = 0; i < 54 * 16 * 54 * 16; i++ ) - { + { int id = biomes[i]->id; // Create following colours: @@ -560,7 +560,7 @@ void BiomeSource::getFracs(intArray indices, float *fracs) bool BiomeSource::getIsMatch(float *frac) { // A true for a particular biome type here marks it as one that *has* to be present - static const bool critical[Biome::BIOME_COUNT] = { + static const bool critical[Biome::BIOME_COUNT] = { true, // ocean true, // plains true, // desert diff --git a/Minecraft.World/BiomeSource.h b/Minecraft.World/BiomeSource.h index a1e8a50b..bef09db0 100644 --- a/Minecraft.World/BiomeSource.h +++ b/Minecraft.World/BiomeSource.h @@ -25,20 +25,20 @@ private: protected: void _init(); - void _init(int64_t seed, LevelType *generator); + void _init(__int64 seed, LevelType *generator); BiomeSource(); public: - BiomeSource(int64_t seed, LevelType *generator); + BiomeSource(__int64 seed, LevelType *generator); BiomeSource(Level *level); private: static bool getIsMatch(float *frac); // 4J added static void getFracs(intArray indices, float *fracs); // 4J added public: #ifdef __PSVITA__ - 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 + static __int64 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 + static __int64 findSeed(LevelType *generator); // 4J added #endif ~BiomeSource(); @@ -71,7 +71,7 @@ public: /** * Checks if an area around a block contains only the specified biomes. * Useful for placing elements like towns. - * + * * This is a bit of a rough check, to make it as fast as possible. To ensure * NO other biomes, add a margin of at least four blocks to the radius */ @@ -80,7 +80,7 @@ public: /** * Checks if an area around a block contains only the specified biome. * Useful for placing elements like towns. - * + * * This is a bit of a rough check, to make it as fast as possible. To ensure * NO other biomes, add a margin of at least four blocks to the radius */ @@ -89,7 +89,7 @@ public: /** * Finds the specified biome within the radius. This will return a random * position if several are found. This test is fairly rough. - * + * * Returns null if the biome wasn't found */ virtual TilePos *findBiome(int x, int z, int r, Biome *toFind, Random *random); @@ -97,7 +97,7 @@ public: /** * Finds one of the specified biomes within the radius. This will return a * random position if several are found. This test is fairly rough. - * + * * Returns null if the biome wasn't found */ virtual TilePos *findBiome(int x, int z, int r, vector<Biome *> allowed, Random *random); diff --git a/Minecraft.World/ByteArrayInputStream.cpp b/Minecraft.World/ByteArrayInputStream.cpp index b0167300..394bda14 100644 --- a/Minecraft.World/ByteArrayInputStream.cpp +++ b/Minecraft.World/ByteArrayInputStream.cpp @@ -51,7 +51,7 @@ int ByteArrayInputStream::read() // //The read(b) method for class InputStream has the same effect as: // -// read(b, 0, b.length) +// read(b, 0, b.length) //Parameters: //b - the buffer into which the data is read. //Returns: @@ -100,7 +100,7 @@ void ByteArrayInputStream::close() //n - the number of bytes to be skipped. //Returns: //the actual number of bytes skipped. -int64_t ByteArrayInputStream::skip(int64_t n) +__int64 ByteArrayInputStream::skip(__int64 n) { int newPos = pos + n; diff --git a/Minecraft.World/ByteArrayInputStream.h b/Minecraft.World/ByteArrayInputStream.h index 5b2d95cf..e74b1cf7 100644 --- a/Minecraft.World/ByteArrayInputStream.h +++ b/Minecraft.World/ByteArrayInputStream.h @@ -19,7 +19,7 @@ public: virtual int read(byteArray b); virtual int read(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual int64_t skip(int64_t n); + virtual __int64 skip(__int64 n); // 4J Stu Added - Sometimes we don't want to delete the data on destroying this void reset() { buf = byteArray(); count = 0; mark = 0; pos = 0; } diff --git a/Minecraft.World/ByteBuffer.cpp b/Minecraft.World/ByteBuffer.cpp index 57b30dbd..66514737 100644 --- a/Minecraft.World/ByteBuffer.cpp +++ b/Minecraft.World/ByteBuffer.cpp @@ -176,20 +176,20 @@ int ByteBuffer::getInt(unsigned int index) // //Returns: //The long value at the buffer's current position -int64_t ByteBuffer::getLong() +__int64 ByteBuffer::getLong() { assert( m_position+8 < m_limit ); - int64_t value = 0; + __int64 value = 0; - int64_t b1 = buffer[ m_position ]; - int64_t b2 = buffer[ m_position+1 ]; - int64_t b3 = buffer[ m_position+2 ]; - int64_t b4 = buffer[ m_position+3 ]; - int64_t b5 = buffer[ m_position+4 ]; - int64_t b6 = buffer[ m_position+5 ]; - int64_t b7 = buffer[ m_position+6 ]; - int64_t b8 = buffer[ m_position+7 ]; + __int64 b1 = buffer[ m_position ]; + __int64 b2 = buffer[ m_position+1 ]; + __int64 b3 = buffer[ m_position+2 ]; + __int64 b4 = buffer[ m_position+3 ]; + __int64 b5 = buffer[ m_position+4 ]; + __int64 b6 = buffer[ m_position+5 ]; + __int64 b7 = buffer[ m_position+6 ]; + __int64 b8 = buffer[ m_position+7 ]; m_position += 8; @@ -358,7 +358,7 @@ ByteBuffer *ByteBuffer::putShortArray(shortArray &s) // TODO 4J Stu - Should this function be writing from the start of the buffer, or from position? // And should it update position? assert( s.length*2 <= m_limit); - + // 4J Stu - Assumes big endian memcpy( buffer, s.data, s.length*2 ); @@ -373,7 +373,7 @@ ByteBuffer *ByteBuffer::putShortArray(shortArray &s) //value - The long value to be written //Returns: //This buffer -ByteBuffer *ByteBuffer::putLong(int64_t value) +ByteBuffer *ByteBuffer::putLong(__int64 value) { assert( m_position+7 < m_limit ); @@ -407,7 +407,7 @@ ByteBuffer *ByteBuffer::putLong(int64_t value) //This method transfers the entire content of the given source byte array into this buffer. //An invocation of this method of the form dst.put(a) behaves in exactly the same way as the invocation // -// dst.put(a, 0, a.length) +// dst.put(a, 0, a.length) //Returns: //This buffer ByteBuffer *ByteBuffer::put(byteArray inputArray) @@ -436,7 +436,7 @@ byteArray ByteBuffer::array() //it will be read-only if, and only if, this buffer is read-only. // //Returns: -//A new int buffer +//A new int buffer IntBuffer *ByteBuffer::asIntBuffer() { // TODO 4J Stu - Is it safe to just cast our byte array pointer to another type? @@ -463,7 +463,7 @@ FloatBuffer *ByteBuffer::asFloatBuffer() #ifdef __PS3__ // 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_IO::ByteBuffer_IO( unsigned int capacity ) : ByteBuffer(capacity, (byte*)RenderManager.allocIOMem(capacity, 64)) { memset( buffer,0,sizeof(byte)*capacity); diff --git a/Minecraft.World/ByteBuffer.h b/Minecraft.World/ByteBuffer.h index 56ac0b96..2d936374 100644 --- a/Minecraft.World/ByteBuffer.h +++ b/Minecraft.World/ByteBuffer.h @@ -28,7 +28,7 @@ public: int getInt(unsigned int index); void get(byteArray) {} // 4J - TODO byte get(int index); - int64_t getLong(); + __int64 getLong(); short getShort(); void getShortArray(shortArray &s); ByteBuffer *put(int index, byte b); @@ -36,7 +36,7 @@ public: ByteBuffer *putInt(unsigned int index, int value); ByteBuffer *putShort(short value); ByteBuffer *putShortArray(shortArray &s); - ByteBuffer *putLong(int64_t value); + ByteBuffer *putLong(__int64 value); ByteBuffer *put(byteArray inputArray); byteArray array(); IntBuffer *asIntBuffer(); diff --git a/Minecraft.World/C4JThread.h b/Minecraft.World/C4JThread.h index 346f123d..9a303c7b 100644 --- a/Minecraft.World/C4JThread.h +++ b/Minecraft.World/C4JThread.h @@ -66,7 +66,7 @@ public: e_modeAutoClear, e_modeManualClear }; - Event(EMode mode = e_modeAutoClear); + Event(EMode mode = e_modeAutoClear); ~Event(); void Set(); void Clear(); @@ -75,7 +75,7 @@ public: private: EMode m_mode; #ifdef __PS3__ - sys_event_flag_t m_event; + sys_event_flag_t m_event; #elif defined __ORBIS__ SceKernelEventFlag m_event; #elif defined __PSVITA__ @@ -111,7 +111,7 @@ public: int m_size; EMode m_mode; #ifdef __PS3__ - sys_event_flag_t m_events; + sys_event_flag_t m_events; #elif defined __ORBIS__ SceKernelEventFlag m_events; #elif defined __PSVITA__ @@ -129,7 +129,7 @@ public: typedef void (ThreadInitFunc)(); C4JThread* m_thread; - std::queue<void*> m_queue; + std::queue<void*> m_queue; C4JThread::EventArray* m_startEvent; C4JThread::Event* m_finishedEvent; CRITICAL_SECTION m_critSect; @@ -187,7 +187,7 @@ private: bool m_isRunning; bool m_hasStarted; int m_exitCode; - int64_t m_lastSleepTime; + __int64 m_lastSleepTime; static std::vector<C4JThread*> ms_threadList; static CRITICAL_SECTION ms_threadListCS; diff --git a/Minecraft.World/CanyonFeature.cpp b/Minecraft.World/CanyonFeature.cpp index 4eea3902..b96c97e0 100644 --- a/Minecraft.World/CanyonFeature.cpp +++ b/Minecraft.World/CanyonFeature.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.level.tile.h" #include "net.minecraft.world.level.biome.h" -void CanyonFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale) +void CanyonFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale) { MemSect(49); Random *random = new Random(seed); diff --git a/Minecraft.World/CanyonFeature.h b/Minecraft.World/CanyonFeature.h index d3edbf1f..cf3f7a61 100644 --- a/Minecraft.World/CanyonFeature.h +++ b/Minecraft.World/CanyonFeature.h @@ -9,6 +9,6 @@ private: float rs[1024]; protected: - void addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale); + void addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale); virtual void addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks); }; diff --git a/Minecraft.World/CaveFeature.cpp b/Minecraft.World/CaveFeature.cpp index 95e5a5be..aad92805 100644 --- a/Minecraft.World/CaveFeature.cpp +++ b/Minecraft.World/CaveFeature.cpp @@ -20,7 +20,7 @@ using namespace std; double radius = random->nextDouble() * 4 + 2; double fuss = random->nextDouble() * 0.6; - int64_t seed = random->nextLong(); + __int64 seed = random->nextLong(); random->setSeed(seed); vector<TilePos *> toRemove; @@ -69,14 +69,14 @@ using namespace std; } } } - + AUTO_VAR(itEnd, toRemove.end()); for (AUTO_VAR(it, toRemove.begin()); it != itEnd; it++) { TilePos *p = *it; //toRemove[i]; level->setTileNoUpdate(p->x, p->y, p->z, 0); } - + itEnd = toRemove.end(); for (AUTO_VAR(it, toRemove.begin()); it != itEnd; it++) { diff --git a/Minecraft.World/ChunkPos.cpp b/Minecraft.World/ChunkPos.cpp index 1bdf165d..3f9674a7 100644 --- a/Minecraft.World/ChunkPos.cpp +++ b/Minecraft.World/ChunkPos.cpp @@ -6,16 +6,16 @@ ChunkPos::ChunkPos(int x, int z) : x( x ), z( z ) { } -int64_t ChunkPos::hashCode(int x, int z) +__int64 ChunkPos::hashCode(int x, int z) { - int64_t xx = x; - int64_t zz = z; + __int64 xx = x; + __int64 zz = z; return (xx & 0xffffffffl) | ((zz & 0xffffffffl) << 32l); } int ChunkPos::hashCode() { - int64_t hash = hashCode(x, z); + __int64 hash = hashCode(x, z); int h1 = (int) (hash); int h2 = (int) (hash >> 32l); return h1 ^ h2; @@ -53,7 +53,7 @@ int ChunkPos::getMiddleBlockZ() return ( z << 4 ) + 8; } -TilePos ChunkPos::getMiddleBlockPosition(int y) +TilePos ChunkPos::getMiddleBlockPosition(int y) { return TilePos(getMiddleBlockX(), y, getMiddleBlockZ()); } @@ -63,7 +63,7 @@ wstring ChunkPos::toString() return L"[" + _toString<int>(x) + L", " + _toString<int>(z) + L"]"; } -int64_t ChunkPos::hash_fnct(const ChunkPos &k) +__int64 ChunkPos::hash_fnct(const ChunkPos &k) { return k.hashCode(k.x,k.z); } diff --git a/Minecraft.World/ChunkPos.h b/Minecraft.World/ChunkPos.h index 55bd1ebb..2a3fda02 100644 --- a/Minecraft.World/ChunkPos.h +++ b/Minecraft.World/ChunkPos.h @@ -10,7 +10,7 @@ public: ChunkPos(int x, int z); - static int64_t hashCode(int x, int z); + static __int64 hashCode(int x, int z); int hashCode(); double distanceToSqr(shared_ptr<Entity> e); @@ -22,7 +22,7 @@ public: TilePos getMiddleBlockPosition(int y); wstring toString(); - static int64_t hash_fnct(const ChunkPos &k); + static __int64 hash_fnct(const ChunkPos &k); static bool eq_test(const ChunkPos &x, const ChunkPos &y); bool operator == (const ChunkPos &k) const { return (this->x == k.x) && ( this->z == k.z); } ChunkPos & operator= (const ChunkPos & other) { x = other.x; z = other.z; return *this; } @@ -30,12 +30,12 @@ public: struct ChunkPosKeyHash { - inline int64_t operator()(const ChunkPos &k) const + inline __int64 operator()(const ChunkPos &k) const { return ChunkPos::hash_fnct(k); } }; struct ChunkPosKeyEq { - inline bool operator()(const ChunkPos &x, const ChunkPos &y) const + inline bool operator()(const ChunkPos &x, const ChunkPos &y) const { return ChunkPos::eq_test(x, y); } };
\ No newline at end of file diff --git a/Minecraft.World/ChunkStorageProfileDecorator.cpp b/Minecraft.World/ChunkStorageProfileDecorator.cpp index 5d757811..76ffddbc 100644 --- a/Minecraft.World/ChunkStorageProfileDecorator.cpp +++ b/Minecraft.World/ChunkStorageProfileDecorator.cpp @@ -10,7 +10,7 @@ ChunkStorageProfilerDecorator::ChunkStorageProfilerDecorator(ChunkStorage *capsu LevelChunk *ChunkStorageProfilerDecorator::load(Level *level, int x, int z) { - int64_t nanoTime = System::nanoTime(); + __int64 nanoTime = System::nanoTime(); LevelChunk *chunk = capsulated->load(level, x, z); timeSpentLoading += System::nanoTime() - nanoTime; loadCount++; @@ -20,7 +20,7 @@ LevelChunk *ChunkStorageProfilerDecorator::load(Level *level, int x, int z) void ChunkStorageProfilerDecorator::save(Level *level, LevelChunk *levelChunk) { - int64_t nanoTime = System::nanoTime(); + __int64 nanoTime = System::nanoTime(); capsulated->save(level, levelChunk); timeSpentSaving += System::nanoTime() - nanoTime; saveCount++; @@ -59,7 +59,7 @@ void ChunkStorageProfilerDecorator::tick() sprintf(buf,"Average save time: %f (%I64d)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); #endif app.DebugPrintf(buf); -#endif +#endif } counter = 0; } diff --git a/Minecraft.World/ChunkStorageProfileDecorator.h b/Minecraft.World/ChunkStorageProfileDecorator.h index 02ea4dcb..67c582da 100644 --- a/Minecraft.World/ChunkStorageProfileDecorator.h +++ b/Minecraft.World/ChunkStorageProfileDecorator.h @@ -8,10 +8,10 @@ class ChunkStorageProfilerDecorator : public ChunkStorage private: ChunkStorage *capsulated; - int64_t timeSpentLoading; - int64_t loadCount; - int64_t timeSpentSaving; - int64_t saveCount; + __int64 timeSpentLoading; + __int64 loadCount; + __int64 timeSpentSaving; + __int64 saveCount; int counter; diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index aa16f8a1..32c31583 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -11,7 +11,7 @@ #include "ByteArrayTag.h" #include "IntArrayTag.h" -class CompoundTag : public Tag +class CompoundTag : public Tag { private: unordered_map<wstring, Tag *> tags; @@ -46,7 +46,7 @@ public: { // 4J - was return tags.values(); vector<Tag *> *ret = new vector<Tag *>; - + AUTO_VAR(itEnd, tags.end()); for( unordered_map<wstring, Tag *>::iterator it = tags.begin(); it != itEnd; it++ ) { @@ -80,7 +80,7 @@ public: tags[name] = (new IntTag(name,value)); } - void putLong(wchar_t * name, int64_t value) + void putLong(wchar_t * name, __int64 value) { tags[name] = (new LongTag(name,value)); } @@ -126,7 +126,7 @@ public: if(it != tags.end()) return it->second; return NULL; } - + bool contains(wchar_t * name) { return tags.find(name) != tags.end(); @@ -150,9 +150,9 @@ public: return ((IntTag *) tags[name])->data; } - int64_t getLong(wchar_t * name) + __int64 getLong(wchar_t * name) { - if (tags.find(name) == tags.end()) return (int64_t)0; + if (tags.find(name) == tags.end()) return (__int64)0; return ((LongTag *) tags[name])->data; } @@ -227,7 +227,7 @@ public: char *newPrefix = new char[ strlen(prefix) + 4 ]; strcpy( newPrefix, prefix); strcat( newPrefix, " "); - + AUTO_VAR(itEnd, tags.end()); for( unordered_map<string, Tag *>::iterator it = tags.begin(); it != itEnd; it++ ) { @@ -255,10 +255,10 @@ public: Tag *copy() { CompoundTag *tag = new CompoundTag(getName()); - + AUTO_VAR(itEnd, tags.end()); for( AUTO_VAR(it, tags.begin()); it != itEnd; it++ ) - { + { tag->put((wchar_t *)it->first.c_str(), it->second->copy()); } return tag; diff --git a/Minecraft.World/CompressedTileStorage.cpp b/Minecraft.World/CompressedTileStorage.cpp index 78b37ad8..896bd58d 100644 --- a/Minecraft.World/CompressedTileStorage.cpp +++ b/Minecraft.World/CompressedTileStorage.cpp @@ -142,7 +142,7 @@ CompressedTileStorage::CompressedTileStorage(bool isEmpty) #endif } -bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (representing a 16 byte range) +bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (representing a 16 byte range) { int block; unsigned short *blockIndices = (unsigned short *)indicesAndData; @@ -151,7 +151,7 @@ bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 ( for( int z = 0; z < 16; z += 4 ) { getBlock(&block, x, y, z); - uint64_t *comp = (uint64_t *)&blockIndices[block]; + __uint64 *comp = (__uint64 *)&blockIndices[block]; // Are the 4 y regions stored here all zero? (INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG ) if( ( *comp ) != 0x0007000700070007L ) return false; } @@ -169,18 +169,18 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage *other) // Attempt to compare as much as we can in 64-byte chunks (8 groups of 8 bytes) int quickCount = allocatedSize / 64; - int64_t *pOld = (int64_t *)indicesAndData; - int64_t *pNew = (int64_t *)other->indicesAndData; + __int64 *pOld = (__int64 *)indicesAndData; + __int64 *pNew = (__int64 *)other->indicesAndData; for( int i = 0; i < quickCount; i++ ) { - int64_t d0 = pOld[0] ^ pNew[0]; - int64_t d1 = pOld[1] ^ pNew[1]; - int64_t d2 = pOld[2] ^ pNew[2]; - int64_t d3 = pOld[3] ^ pNew[3]; - int64_t d4 = pOld[4] ^ pNew[4]; - int64_t d5 = pOld[5] ^ pNew[5]; - int64_t d6 = pOld[6] ^ pNew[6]; - int64_t d7 = pOld[7] ^ pNew[7]; + __int64 d0 = pOld[0] ^ pNew[0]; + __int64 d1 = pOld[1] ^ pNew[1]; + __int64 d2 = pOld[2] ^ pNew[2]; + __int64 d3 = pOld[3] ^ pNew[3]; + __int64 d4 = pOld[4] ^ pNew[4]; + __int64 d5 = pOld[5] ^ pNew[5]; + __int64 d6 = pOld[6] ^ pNew[6]; + __int64 d7 = pOld[7] ^ pNew[7]; d0 |= d1; d2 |= d3; d4 |= d5; @@ -194,7 +194,7 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage *other) } pOld += 8; pNew += 8; - } + } // Now test anything remaining just byte at a time unsigned char *pucOld = (unsigned char *)pOld; @@ -261,7 +261,7 @@ inline int CompressedTileStorage::getIndex(int block, int tile) // and z is: ___________zzzz // and maps to this bit of b ________bb_____ // and this bit of t ___________tt__ -// +// inline void CompressedTileStorage::getBlockAndTile(int *block, int *tile, int x, int y, int z) { @@ -302,7 +302,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) int offsets[512]; int memToAlloc = 0; // static int type0 = 0, type1 = 0, type2 = 0, type4 = 0, type8 = 0, chunkTotal = 0; - + // Loop round all blocks for( int i = 0; i < 512; i++ ) { @@ -332,8 +332,8 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) } } #else - uint64_t usedFlags[4] = {0,0,0,0}; - int64_t i64_1 = 1; // MGH - instead of 1i64, which is MS specific + __uint64 usedFlags[4] = {0,0,0,0}; + __int64 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 4 tiles in the block { int tile = data[getIndex(i,j)]; @@ -889,7 +889,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) unsigned char *unpacked_data = NULL; unsigned char *packed_data; - // First task is to find out what type of storage each block needs. Need to unpack each where required. + // First task is to find out what type of storage each block needs. Need to unpack each where required. // Note that we don't need to fully unpack the data at this stage since we are only interested in working out how many unique types of tiles are in each block, not // what those actual tile ids are. if( upgradeBlock == -1 ) @@ -950,8 +950,8 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) } #else - uint64_t usedFlags[4] = {0,0,0,0}; - int64_t i64_1 = 1; // MGH - instead of 1i64, which is MS specific + __uint64 usedFlags[4] = {0,0,0,0}; + __int64 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 4x4x4 tiles in the block { int tiletype = unpacked_data[j]; @@ -1025,7 +1025,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) } } switch(_blockIndices[i]) - { + { case INDEX_TYPE_1_BIT: memToAlloc += 10; break; @@ -1096,7 +1096,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) else { packed_data = data + ( ( blockIndices[i] >> INDEX_OFFSET_SHIFT ) & INDEX_OFFSET_MASK); - + int dataSize = 8 << indexTypeOld; // 8, 16 or 32 bytes of per-tile storage dataSize += 1 << ( 1 << indexTypeOld ); // 2, 4 or 16 bytes to store each tile type newIndices[i] |= ( usDataOffset & INDEX_OFFSET_MASK) << INDEX_OFFSET_SHIFT; @@ -1289,7 +1289,7 @@ int CompressedTileStorage::getHighestNonEmptyY() if(found) break; } - + int highestNonEmptyY = -1; if(found) { diff --git a/Minecraft.World/ConsoleSaveFileInputStream.h b/Minecraft.World/ConsoleSaveFileInputStream.h index 7f4a69c4..876a9484 100644 --- a/Minecraft.World/ConsoleSaveFileInputStream.h +++ b/Minecraft.World/ConsoleSaveFileInputStream.h @@ -17,7 +17,7 @@ public: virtual int read(byteArray b); virtual int read(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual int64_t skip(int64_t n) { return n; } + virtual __int64 skip(__int64 n) { return n; } private: ConsoleSaveFile *m_saveFile; diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index 58765a4c..139d99ac 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -35,7 +35,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID // We'll only be committing these as required to grow the storage we need, which will // the storage to grow without having to use realloc. - // AP - The Vita doesn't have virtual memory so a pretend system has been implemented in PSVitaStubs.cpp. + // AP - The Vita doesn't have virtual memory so a pretend system has been implemented in PSVitaStubs.cpp. // All access to the memory must be done via the access function as the pointer returned from VirtualAlloc // can't be used directly. pvHeap = VirtualAlloc(NULL, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE ); @@ -116,7 +116,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID #endif app.DebugPrintf("Filesize - %d, Adjusted size - %d\n",fileSize,storageLength); fileSize = storageLength; - } + } #ifdef __PSVITA__ if(plat == SAVE_FILE_PLATFORM_PSVITA) @@ -202,7 +202,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID } else - { + { // Clear the first 8 bytes that reference the header header.WriteHeader( pvSaveMem ); } @@ -213,7 +213,7 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT ); 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 defined _XBOX +#if defined _XBOX app.GetSaveThumbnail(NULL,NULL); #elif defined __PS3__ app.GetSaveThumbnail(NULL,NULL, NULL,NULL); @@ -548,7 +548,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt if ( uiCopyEnd > uiFromEnd ) { // Needs to be clamped to the end of our region - uiCopyEnd = uiFromEnd; + uiCopyEnd = uiFromEnd; } #ifdef __PSVITA__ // AP - use this to access the virtual memory @@ -749,7 +749,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); - int64_t seed = 0; + __int64 seed = 0; bool hasSeed = false; if(MinecraftServer::getInstance()!= NULL && MinecraftServer::getInstance()->levels[0]!=NULL) { @@ -765,7 +765,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) #ifdef _XBOX StorageManager.SaveSaveData( compLength+8,pbThumbnailData,dwThumbnailDataSize,bTextMetadata,iTextMetadataBytes ); - delete [] pbThumbnailData; + delete [] pbThumbnailData; #ifndef _CONTENT_PACKAGE if( app.DebugSettingsOn()) { diff --git a/Minecraft.World/ConsoleSaveFileSplit.cpp b/Minecraft.World/ConsoleSaveFileSplit.cpp index 9fe7f8c7..2d83f217 100644 --- a/Minecraft.World/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/ConsoleSaveFileSplit.cpp @@ -41,7 +41,7 @@ ConsoleSaveFileSplit::RegionFileReference::~RegionFileReference() // Compress from data to dataCompressed. Uses a special compression method that is designed just to efficiently store runs of zeros, with little overhead on other stuff. // Compresed format is a 4 byte uncompressed size, followed by data as follows: -// +// // Byte value Meaning // // 1 - 255 Normal data @@ -375,7 +375,7 @@ FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) int index = StorageManager.AddSubfile(regionIndex); RegionFileReference *newRef = new RegionFileReference(index, regionIndex); regionFiles[regionIndex] = newRef; - + return newRef->fileEntry; } @@ -513,7 +513,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO StorageManager.GetSaveData( pvSaveMem, &storageLength ); app.DebugPrintf("Filesize - %d, Adjusted size - %d\n",fileSize,storageLength); fileSize = storageLength; - } + } int compressed = *(int*)pvSaveMem; if( compressed == 0 ) @@ -532,7 +532,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO else { unsigned char *buf = new unsigned char[decompSize]; - + if( Compression::getCompression()->Decompress(buf, &decompSize, (unsigned char *)pvSaveMem+8, fileSize-8 ) == S_OK) { @@ -575,7 +575,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO } else - { + { // Clear the first 8 bytes that reference the header header.WriteHeader( pvSaveMem ); } @@ -586,7 +586,7 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit() VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT ); 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 defined _XBOX +#if defined _XBOX app.GetSaveThumbnail(NULL,NULL); #elif defined __PS3__ app.GetSaveThumbnail(NULL,NULL, NULL,NULL); @@ -606,7 +606,7 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit() FileEntry *ConsoleSaveFileSplit::createFile( const ConsoleSavePath &fileName ) { LockSaveAccess(); - + // Determine if the file is a region file that should be split off into its own file unsigned int regionFileIndex; bool isRegionFile = GetNumericIdentifierFromName(fileName.getName(), ®ionFileIndex); @@ -942,7 +942,7 @@ void ConsoleSaveFileSplit::tick() } } - // Compile a vector of dirty regions. + // Compile a vector of dirty regions. vector<DirtyRegionFile> dirtyRegions; for( AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++ ) { @@ -999,7 +999,7 @@ void ConsoleSaveFileSplit::tick() { unsigned int totalDirty = 0; unsigned int totalDirtyBytes = 0; - int64_t oldestDirty = currentTime; + __int64 oldestDirty = currentTime; for( AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++ ) { if( it->second->dirty ) @@ -1051,7 +1051,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - + DWORD desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; if( desiredSize > currentHeapSize ) @@ -1117,7 +1117,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT if ( uiCopyEnd > uiFromEnd ) { // Needs to be clamped to the end of our region - uiCopyEnd = uiFromEnd; + uiCopyEnd = uiFromEnd; } XMemCpy( (void *)(uiCopyStart + nNumberOfBytesToWrite), ( void *)uiCopyStart, uiCopyEnd - uiCopyStart ); } @@ -1381,7 +1381,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) // Attempt to allocate the required memory compData = (byte *)StorageManager.AllocateSaveData( compLength ); } - + if(compData != NULL) { // Re-compress all save data before we save it to disk @@ -1421,7 +1421,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); - int64_t seed = 0; + __int64 seed = 0; bool hasSeed = false; if(MinecraftServer::getInstance()!= NULL && MinecraftServer::getInstance()->levels[0]!=NULL) { @@ -1436,7 +1436,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) app.DebugPrintf("Save thumbnail size %d\n",dwThumbnailDataSize); } - + INT saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); TelemetryManager->RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId, compLength+8); @@ -1459,7 +1459,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes) { ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam; - + // Don't save sub files on autosave (their always being saved anyway) if (!pClass->m_autosave) { @@ -1472,7 +1472,7 @@ int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes) int ConsoleSaveFileSplit::SaveRegionFilesCallback(LPVOID lpParam,bool bRes) { ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam; - + // This is called from the StorageManager.Tick() which should always be on the main thread pClass->processSubfilesAfterWrite(); diff --git a/Minecraft.World/CustomLevelSource.cpp b/Minecraft.World/CustomLevelSource.cpp index 0d8ad81c..216e63b9 100644 --- a/Minecraft.World/CustomLevelSource.cpp +++ b/Minecraft.World/CustomLevelSource.cpp @@ -12,7 +12,7 @@ const double CustomLevelSource::SNOW_SCALE = 0.3; const double CustomLevelSource::SNOW_CUTOFF = 0.5; -CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateStructures) : generateStructures( generateStructures ) +CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateStructures) : generateStructures( generateStructures ) { #ifdef _OVERRIDE_HEIGHTMAP m_XZSize = level->getLevelData()->getXZSize(); @@ -326,7 +326,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi run = runDepth; if (y >= waterHeight - 1) blocks[offs] = top; else blocks[offs] = material; - } + } else if (run > 0) { run--; @@ -399,7 +399,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs) // addCaves(xOffs, zOffs, blocks); // addTowns(xOffs, zOffs, blocks); - // levelChunk->recalcHeightmap(); // 4J - removed & moved into its own method + // levelChunk->recalcHeightmap(); // 4J - removed & moved into its own method // 4J - this now creates compressed block data from the blocks array passed in, so moved it until after the blocks are actually finalised. We also // now need to free the passed in blocks as the LevelChunk doesn't use the passed in allocation anymore. @@ -504,8 +504,8 @@ void CustomLevelSource::postProcess(ChunkSource *parent, int xt, int zt) } pprandom->setSeed(level->getSeed()); - int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; - int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); bool hasVillage = false; diff --git a/Minecraft.World/CustomLevelSource.h b/Minecraft.World/CustomLevelSource.h index 35b22554..af01a478 100644 --- a/Minecraft.World/CustomLevelSource.h +++ b/Minecraft.World/CustomLevelSource.h @@ -44,7 +44,7 @@ private: const bool generateStructures; public: - CustomLevelSource(Level *level, int64_t seed, bool generateStructures); + CustomLevelSource(Level *level, __int64 seed, bool generateStructures); ~CustomLevelSource(); public: @@ -75,5 +75,5 @@ public: public: virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/DataInput.h b/Minecraft.World/DataInput.h index f61eceb5..258b2717 100644 --- a/Minecraft.World/DataInput.h +++ b/Minecraft.World/DataInput.h @@ -13,7 +13,7 @@ public: virtual double readDouble() = 0; virtual float readFloat() = 0; virtual int readInt() = 0; - virtual int64_t readLong() = 0; + virtual __int64 readLong() = 0; virtual short readShort() = 0; virtual wchar_t readChar() = 0; virtual wstring readUTF() = 0; diff --git a/Minecraft.World/DataInputStream.cpp b/Minecraft.World/DataInputStream.cpp index 3bdd5349..2291bf48 100644 --- a/Minecraft.World/DataInputStream.cpp +++ b/Minecraft.World/DataInputStream.cpp @@ -32,8 +32,8 @@ int DataInputStream::read() // //The read(b) method has the same effect as: // -// read(b, 0, b.length) -// +// read(b, 0, b.length) +// //Overrides: //read in class FilterInputStream //Parameters: @@ -102,7 +102,7 @@ unsigned char DataInputStream::readUnsignedByte() //Reads two input bytes and returns a char value. Let a be the first byte read and b be the second byte. The value returned is: //(char)((a << 8) | (b & 0xff)) -// +// //This method is suitable for reading bytes written by the writeChar method of interface DataOutput. //Returns: //the char value read. @@ -110,7 +110,7 @@ wchar_t DataInputStream::readChar() { int a = stream->read(); int b = stream->read(); - return (wchar_t)((a << 8) | (b & 0xff)); + return (wchar_t)((a << 8) | (b & 0xff)); } //Reads some bytes from an input stream and stores them into the buffer array b. The number of bytes read is equal to the length of b. @@ -170,7 +170,7 @@ bool DataInputStream::readFully(charArray b) //the double value read. double DataInputStream::readDouble() { - int64_t bits = readLong(); + __int64 bits = readLong(); return Double::longBitsToDouble( bits ); } @@ -188,10 +188,10 @@ float DataInputStream::readFloat() } //Reads four input bytes and returns an int value. Let a-d be the first through fourth bytes read. The value returned is: -// +// // (((a & 0xff) << 24) | ((b & 0xff) << 16) | // ((c & 0xff) << 8) | (d & 0xff)) -// +// //This method is suitable for reading bytes written by the writeInt method of interface DataOutput. //Returns: //the int value read. @@ -207,7 +207,7 @@ int DataInputStream::readInt() } //Reads eight input bytes and returns a long value. Let a-h be the first through eighth bytes read. The value returned is: -// +// // (((long)(a & 0xff) << 56) | // ((long)(b & 0xff) << 48) | // ((long)(c & 0xff) << 40) | @@ -216,23 +216,23 @@ int DataInputStream::readInt() // ((long)(f & 0xff) << 16) | // ((long)(g & 0xff) << 8) | // ((long)(h & 0xff))) -// +// //This method is suitable for reading bytes written by the writeLong method of interface DataOutput. // //Returns: //the long value read. -int64_t DataInputStream::readLong() +__int64 DataInputStream::readLong() { - int64_t a = stream->read(); - int64_t b = stream->read(); - int64_t c = stream->read(); - int64_t d = stream->read(); - int64_t e = stream->read(); - int64_t f = stream->read(); - int64_t g = stream->read(); - int64_t h = stream->read(); - - int64_t bits = (((a & 0xff) << 56) | + __int64 a = stream->read(); + __int64 b = stream->read(); + __int64 c = stream->read(); + __int64 d = stream->read(); + __int64 e = stream->read(); + __int64 f = stream->read(); + __int64 g = stream->read(); + __int64 h = stream->read(); + + __int64 bits = (((a & 0xff) << 56) | ((b & 0xff) << 48) | ((c & 0xff) << 40) | ((d & 0xff) << 32) | @@ -246,7 +246,7 @@ int64_t DataInputStream::readLong() //Reads two input bytes and returns a short value. Let a be the first byte read and b be the second byte. The value returned is: //(short)((a << 8) | (b & 0xff)) -// +// //This method is suitable for reading the bytes written by the writeShort method of interface DataOutput. //Returns: //the 16-bit value read. @@ -272,13 +272,13 @@ short DataInputStream::readShort() //then a UTFDataFormatException is thrown. Otherwise, the group is converted to the character: // //(char)(((a& 0x1F) << 6) | (b & 0x3F)) -// +// //If the first byte of a group matches the bit pattern 1110xxxx, then the group consists of that byte a and two more bytes b and c. //If there is no byte c (because byte a was one of the last two of the bytes to be read), or either byte b or byte c does not match the bit //pattern 10xxxxxx, then a UTFDataFormatException is thrown. Otherwise, the group is converted to the character: // // (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F)) -// +// //If the first byte of a group matches the pattern 1111xxxx or the pattern 10xxxxxx, then a UTFDataFormatException is thrown. //If end of file is encountered at any time during this entire process, then an EOFException is thrown. // @@ -305,7 +305,7 @@ wstring DataInputStream::readUTF() outputString.push_back(theChar); }*/ - + unsigned short currentByteIndex = 0; while( currentByteIndex < UTFLength ) { @@ -390,7 +390,7 @@ wstring DataInputStream::readUTF() { // TODO 4J Stu - EOFException break; - } + } // No more bytes to read if( !(currentByteIndex < UTFLength) ) @@ -420,7 +420,7 @@ wstring DataInputStream::readUTF() continue; } } - + return outputString; } @@ -486,7 +486,7 @@ int DataInputStream::readUTFChar() { // TODO 4J Stu - EOFException return returnValue; - } + } int thirdByte = stream->read(); @@ -535,7 +535,7 @@ void DataInputStream::deleteChildStream() //n - the number of bytes to be skipped. //Returns: //the actual number of bytes skipped. -int64_t DataInputStream::skip(int64_t n) +__int64 DataInputStream::skip(__int64 n) { return stream->skip(n); } diff --git a/Minecraft.World/DataInputStream.h b/Minecraft.World/DataInputStream.h index 043ab745..f69d490a 100644 --- a/Minecraft.World/DataInputStream.h +++ b/Minecraft.World/DataInputStream.h @@ -24,12 +24,12 @@ public: virtual double readDouble(); virtual float readFloat(); virtual int readInt(); - virtual int64_t readLong(); + virtual __int64 readLong(); virtual short readShort(); virtual wstring readUTF(); void deleteChildStream(); virtual int readUTFChar(); virtual PlayerUID readPlayerUID(); // 4J Added - virtual int64_t skip(int64_t n); + virtual __int64 skip(__int64 n); virtual int skipBytes(int n); };
\ No newline at end of file diff --git a/Minecraft.World/DataOutput.h b/Minecraft.World/DataOutput.h index 7ebf96da..648be6df 100644 --- a/Minecraft.World/DataOutput.h +++ b/Minecraft.World/DataOutput.h @@ -10,7 +10,7 @@ public: virtual void writeDouble(double a) = 0; virtual void writeFloat(float a) = 0; virtual void writeInt(int a) = 0; - virtual void writeLong(int64_t a) = 0; + virtual void writeLong(__int64 a) = 0; virtual void writeShort(short a) = 0; virtual void writeBoolean(bool v) = 0; virtual void writeChar(wchar_t v) = 0; diff --git a/Minecraft.World/DataOutputStream.cpp b/Minecraft.World/DataOutputStream.cpp index ede943d2..8e277c23 100644 --- a/Minecraft.World/DataOutputStream.cpp +++ b/Minecraft.World/DataOutputStream.cpp @@ -78,7 +78,7 @@ void DataOutputStream::writeByte(byte a) //v - a double value to be written. void DataOutputStream::writeDouble(double a) { - int64_t bits = Double::doubleToLongBits( a ); + __int64 bits = Double::doubleToLongBits( a ); writeLong( bits ); // TODO 4J Stu - Error handling? @@ -116,7 +116,7 @@ void DataOutputStream::writeInt(int a) //In no exception is thrown, the counter written is incremented by 8. //Parameters: //v - a long to be written. -void DataOutputStream::writeLong(int64_t a) +void DataOutputStream::writeLong(__int64 a) { stream->write( (a >> 56) & 0xff ); stream->write( (a >> 48) & 0xff ); @@ -178,7 +178,7 @@ void DataOutputStream::writeBoolean(bool b) { stream->write( b ? (byte)1 : (byte)0 ); // TODO 4J Stu - Error handling? - written += 1; + written += 1; } //Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner. @@ -220,7 +220,7 @@ void DataOutputStream::writeUTF(const wstring& str) byteArray bytearr(utflen+2); bytearr[count++] = (byte) ((utflen >> 8) & 0xFF); - bytearr[count++] = (byte) ((utflen >> 0) & 0xFF); + bytearr[count++] = (byte) ((utflen >> 0) & 0xFF); int i=0; for (i=0; i<strlen; i++) diff --git a/Minecraft.World/DataOutputStream.h b/Minecraft.World/DataOutputStream.h index 7337be34..01be8309 100644 --- a/Minecraft.World/DataOutputStream.h +++ b/Minecraft.World/DataOutputStream.h @@ -26,11 +26,11 @@ public: virtual void writeDouble(double a); virtual void writeFloat(float a); virtual void writeInt(int a); - virtual void writeLong(int64_t a); + virtual void writeLong(__int64 a); virtual void writeShort(short a); virtual void writeChar(wchar_t a); virtual void writeChars(const wstring& a); - virtual void writeBoolean(bool b); + virtual void writeBoolean(bool b); virtual void writeUTF(const wstring& a); virtual void writePlayerUID(PlayerUID player); virtual void flush(); diff --git a/Minecraft.World/DerivedLevelData.cpp b/Minecraft.World/DerivedLevelData.cpp index da3d048d..71c4d87b 100644 --- a/Minecraft.World/DerivedLevelData.cpp +++ b/Minecraft.World/DerivedLevelData.cpp @@ -22,7 +22,7 @@ CompoundTag *DerivedLevelData::createTag(vector<shared_ptr<Player> > *players) return wrapped->createTag(players); } -int64_t DerivedLevelData::getSeed() +__int64 DerivedLevelData::getSeed() { return wrapped->getSeed(); } @@ -43,12 +43,12 @@ int DerivedLevelData::getZSpawn() return wrapped->getZSpawn(); } -int64_t DerivedLevelData::getTime() +__int64 DerivedLevelData::getTime() { return wrapped->getTime(); } -int64_t DerivedLevelData::getSizeOnDisk() +__int64 DerivedLevelData::getSizeOnDisk() { return wrapped->getSizeOnDisk(); } @@ -68,7 +68,7 @@ int DerivedLevelData::getVersion() return wrapped->getVersion(); } -int64_t DerivedLevelData::getLastPlayed() +__int64 DerivedLevelData::getLastPlayed() { return wrapped->getLastPlayed(); } @@ -98,7 +98,7 @@ GameType *DerivedLevelData::getGameType() return wrapped->getGameType(); } -void DerivedLevelData::setSeed(int64_t seed) +void DerivedLevelData::setSeed(__int64 seed) { } @@ -114,11 +114,11 @@ void DerivedLevelData::setZSpawn(int zSpawn) { } -void DerivedLevelData::setTime(int64_t time) +void DerivedLevelData::setTime(__int64 time) { } -void DerivedLevelData::setSizeOnDisk(int64_t sizeOnDisk) +void DerivedLevelData::setSizeOnDisk(__int64 sizeOnDisk) { } diff --git a/Minecraft.World/DerivedLevelData.h b/Minecraft.World/DerivedLevelData.h index db5a72d2..a39f7d04 100644 --- a/Minecraft.World/DerivedLevelData.h +++ b/Minecraft.World/DerivedLevelData.h @@ -16,27 +16,27 @@ protected: public: CompoundTag *createTag(); CompoundTag *createTag(vector<shared_ptr<Player> > *players); - int64_t getSeed(); + __int64 getSeed(); int getXSpawn(); int getYSpawn(); int getZSpawn(); - int64_t getTime(); - int64_t getSizeOnDisk(); + __int64 getTime(); + __int64 getSizeOnDisk(); CompoundTag *getLoadedPlayerTag(); wstring getLevelName(); int getVersion(); - int64_t getLastPlayed(); + __int64 getLastPlayed(); bool isThundering(); int getThunderTime(); bool isRaining(); int getRainTime(); GameType *getGameType(); - void setSeed(int64_t seed); + void setSeed(__int64 seed); void setXSpawn(int xSpawn); void setYSpawn(int ySpawn); void setZSpawn(int zSpawn); - void setTime(int64_t time); - void setSizeOnDisk(int64_t sizeOnDisk); + void setTime(__int64 time); + void setSizeOnDisk(__int64 sizeOnDisk); void setLoadedPlayerTag(CompoundTag *loadedPlayerTag); void setDimension(int dimension); void setSpawn(int xSpawn, int ySpawn, int zSpawn); diff --git a/Minecraft.World/Dimension.cpp b/Minecraft.World/Dimension.cpp index 71e93a63..35e66698 100644 --- a/Minecraft.World/Dimension.cpp +++ b/Minecraft.World/Dimension.cpp @@ -41,11 +41,11 @@ void Dimension::init() } else #endif - if (level->getLevelData()->getGenerator() == LevelType::lvl_flat) + if (level->getLevelData()->getGenerator() == LevelType::lvl_flat) { biomeSource = new FixedBiomeSource(Biome::plains, 0.5f, 0.5f); } - else + else { biomeSource = new BiomeSource(level); } @@ -77,11 +77,11 @@ ChunkSource *Dimension::createRandomLevelSource() const } else #endif - if (levelType == LevelType::lvl_flat) + if (levelType == LevelType::lvl_flat) { return new FlatLevelSource(level, level->getSeed(), level->getLevelData()->isGenerateMapFeatures()); - } - else + } + else { return new RandomLevelSource(level, level->getSeed(), level->getLevelData()->isGenerateMapFeatures()); } @@ -106,7 +106,7 @@ bool Dimension::isValidSpawn(int x, int z) const return true; } -float Dimension::getTimeOfDay(int64_t time, float a) const +float Dimension::getTimeOfDay(__int64 time, float a) const { int dayStep = (int) (time % Level::TICKS_PER_DAY); float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f; @@ -118,7 +118,7 @@ float Dimension::getTimeOfDay(int64_t time, float a) const return td; } -int Dimension::getMoonPhase(int64_t time, float a) const +int Dimension::getMoonPhase(__int64 time, float a) const { return ((int) (time / Level::TICKS_PER_DAY)) % 8; } @@ -162,7 +162,7 @@ Vec3 *Dimension::getFogColor(float td, float a) const float br = Mth::cos(td * PI * 2) * 2 + 0.5f; if (br < 0.0f) br = 0.0f; if (br > 1.0f) br = 1.0f; - + unsigned int baseFogColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Default_Fog_Colour ); float r = ((baseFogColour >> 16) & 0xff) / 255.0f; float g = ((baseFogColour >> 8) & 0xff) / 255.0f; @@ -203,16 +203,16 @@ Pos *Dimension::getSpawnPos() return NULL; } -int Dimension::getSpawnYPosition() +int Dimension::getSpawnYPosition() { - if (levelType == LevelType::lvl_flat) + if (levelType == LevelType::lvl_flat) { return 4; } return Level::genDepth / 2; } -bool Dimension::hasBedrockFog() +bool Dimension::hasBedrockFog() { // 4J-PB - turn off bedrock fog if the host player doesn't want it if(app.GetGameHostOption(eGameHostOption_BedrockFog)==0) @@ -223,9 +223,9 @@ bool Dimension::hasBedrockFog() return (levelType != LevelType::lvl_flat && !hasCeiling); } -double Dimension::getClearColorScale() +double Dimension::getClearColorScale() { - if (levelType == LevelType::lvl_flat) + if (levelType == LevelType::lvl_flat) { return 1.0; } diff --git a/Minecraft.World/Dimension.h b/Minecraft.World/Dimension.h index 5231c237..36df385e 100644 --- a/Minecraft.World/Dimension.h +++ b/Minecraft.World/Dimension.h @@ -35,8 +35,8 @@ public: virtual bool isValidSpawn(int x, int z) const; - virtual float getTimeOfDay(int64_t time, float a) const; - virtual int getMoonPhase(int64_t time, float a) const; + virtual float getTimeOfDay(__int64 time, float a) const; + virtual int getMoonPhase(__int64 time, float a) const; virtual bool isNaturalDimension(); private: static const int fogColor = 0xc0d8ff; @@ -53,7 +53,7 @@ public: virtual Pos *getSpawnPos(); int getSpawnYPosition(); - virtual bool hasBedrockFog(); + virtual bool hasBedrockFog(); double getClearColorScale(); virtual bool isFoggyAt(int x, int z); diff --git a/Minecraft.World/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index 5a1dfc0a..27514c9b 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -108,19 +108,19 @@ void _MapDataMappings_old::setMapping(int id, PlayerUID xuid, int dimension) #ifdef _LARGE_WORLDS void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX, int centreZ, int dimension, int scale) { - int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); + __int64 index = ( ((__int64)(centreZ & 0x1FFFFFFF)) << 34) | ( ((__int64)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); m_mappings[index] = id; //app.DebugPrintf("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index); } bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int centreZ, int dimension, int scale) { - //int64_t zMasked = centreZ & 0x1FFFFFFF; - //int64_t xMasked = centreX & 0x1FFFFFFF; - //int64_t zShifted = zMasked << 34; - //int64_t xShifted = xMasked << 5; + //__int64 zMasked = centreZ & 0x1FFFFFFF; + //__int64 xMasked = centreX & 0x1FFFFFFF; + //__int64 zShifted = zMasked << 34; + //__int64 xShifted = xMasked << 5; //app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); - int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); + __int64 index = ( ((__int64)(centreZ & 0x1FFFFFFF)) << 34) | ( ((__int64)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); AUTO_VAR(it,m_mappings.find(index)); if(it != m_mappings.end()) { @@ -151,7 +151,7 @@ void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream *dis) int count = dis->readInt(); for(unsigned int i = 0; i < count; ++i) { - int64_t index = dis->readLong(); + __int64 index = dis->readLong(); int id = dis->readInt(); m_mappings[index] = id; app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", index, index, id); @@ -233,7 +233,7 @@ ChunkStorage *DirectoryLevelStorage::createChunkStorage(Dimension *dimension) return new OldChunkStorage(dir, true); } -LevelData *DirectoryLevelStorage::prepareLevel() +LevelData *DirectoryLevelStorage::prepareLevel() { // 4J Stu Added #ifdef _LARGE_WORLDS @@ -295,7 +295,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() #else if(getSaveFile()->getSaveVersion() < END_DIMENSION_MAP_MAPPINGS_SAVE_VERSION) - { + { MapDataMappings_old oldMapDataMappings; getSaveFile()->readFile( fileEntry, &oldMapDataMappings, // data buffer @@ -334,7 +334,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); - if ( m_saveFile->doesFileExist( dataFile ) ) + if ( m_saveFile->doesFileExist( dataFile ) ) { ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(m_saveFile, dataFile); CompoundTag *root = NbtIo::readCompressed(&fis); @@ -429,7 +429,7 @@ void DirectoryLevelStorage::save(shared_ptr<Player> player) } // 4J Changed return val to bool to check if new player or loaded player -bool DirectoryLevelStorage::load(shared_ptr<Player> player) +bool DirectoryLevelStorage::load(shared_ptr<Player> player) { bool newPlayer = true; CompoundTag *tag = loadPlayerDataTag( player->getXuid() ); @@ -499,7 +499,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() m_saveFile->deleteFile( playerFiles->at(i) ); } } - else + else #endif if( playerFiles->size() > MAX_PLAYER_DATA_SAVES ) { @@ -523,12 +523,12 @@ void DirectoryLevelStorage::clearOldPlayerFiles() } } -PlayerIO *DirectoryLevelStorage::getPlayerIO() +PlayerIO *DirectoryLevelStorage::getPlayerIO() { return this; } -void DirectoryLevelStorage::closeAll() +void DirectoryLevelStorage::closeAll() { } @@ -582,7 +582,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions() // If the player is in the nether, set their y position above the top of the nether // This will force the player to be spawned in a valid position in the overworld when they are loaded if(tag->contains(L"Dimension") && tag->getInt(L"Dimension") == LevelData::DIMENSION_NETHER && tag->contains(L"Pos")) - { + { ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) tag->getList(L"Pos"); pos->get(1)->data = DBL_MAX; diff --git a/Minecraft.World/DirectoryLevelStorage.h b/Minecraft.World/DirectoryLevelStorage.h index e47769d9..820ef31f 100644 --- a/Minecraft.World/DirectoryLevelStorage.h +++ b/Minecraft.World/DirectoryLevelStorage.h @@ -54,7 +54,7 @@ typedef struct _MapDataMappings_old void setMapping(int id, PlayerUID xuid, int dimension); } MapDataMappings_old; -class DirectoryLevelStorage : public LevelStorage, public PlayerIO +class DirectoryLevelStorage : public LevelStorage, public PlayerIO { private: /* 4J Jev, Probably no need for this as theres no exceptions being thrown. @@ -65,7 +65,7 @@ private: const ConsoleSavePath playerDir; //const File dataDir; const ConsoleSavePath dataDir; - const int64_t sessionId; + const __int64 sessionId; const wstring levelId; static const wstring sc_szPlayerDir; @@ -75,7 +75,7 @@ private: { friend class DirectoryLevelStorage; private: - unordered_map<int64_t, short> m_mappings; + unordered_map<__int64, short> m_mappings; public: void addMapping(int id, int centreX, int centreZ, int dimension, int scale); @@ -92,7 +92,7 @@ private: #else MapDataMappings m_mapDataMappings; MapDataMappings m_saveableMapDataMappings; -#endif +#endif bool m_bHasLoadedMapDataMappings; unordered_map<wstring, ByteArrayOutputStream *> m_cachedSaveData; diff --git a/Minecraft.World/EmptyLevelChunk.cpp b/Minecraft.World/EmptyLevelChunk.cpp index 4934ac96..80460b10 100644 --- a/Minecraft.World/EmptyLevelChunk.cpp +++ b/Minecraft.World/EmptyLevelChunk.cpp @@ -210,7 +210,7 @@ bool EmptyLevelChunk::testSetBlocksAndData(byteArray data, int x0, int y0, int z return false; } -Random *EmptyLevelChunk::getRandom(int64_t l) +Random *EmptyLevelChunk::getRandom(__int64 l) { return new Random((level->getSeed() + x * x * 4987142 + x * 5947611 + z * z * 4392871l + z * 389711) ^ l); } diff --git a/Minecraft.World/EmptyLevelChunk.h b/Minecraft.World/EmptyLevelChunk.h index a8ff27f9..02ffc176 100644 --- a/Minecraft.World/EmptyLevelChunk.h +++ b/Minecraft.World/EmptyLevelChunk.h @@ -48,7 +48,7 @@ public: int getBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter int setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter bool testSetBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p); // 4J added - Random *getRandom(int64_t l); + Random *getRandom(__int64 l); bool isEmpty(); virtual void reSyncLighting() {}; // 4J added }; diff --git a/Minecraft.World/EnchantmentMenu.h b/Minecraft.World/EnchantmentMenu.h index 62408f1d..e09b94c6 100644 --- a/Minecraft.World/EnchantmentMenu.h +++ b/Minecraft.World/EnchantmentMenu.h @@ -23,7 +23,7 @@ private: bool m_costsChanged; // 4J Added public: - int64_t nameSeed; + __int64 nameSeed; public: int costs[3]; diff --git a/Minecraft.World/FileHeader.h b/Minecraft.World/FileHeader.h index 9205e5b4..203ec322 100644 --- a/Minecraft.World/FileHeader.h +++ b/Minecraft.World/FileHeader.h @@ -96,7 +96,7 @@ public: }; - int64_t lastModifiedTime; // 8B + __int64 lastModifiedTime; // 8B }; typedef FileEntrySaveDataV2 FileEntrySaveData; @@ -122,7 +122,7 @@ public: currentFilePointer = data.startOffset; } - unsigned int getFileSize() { return data.length; } + unsigned int getFileSize() { return data.length; } bool isRegionFile() { return data.filename[0] == 0; } // When using ConsoleSaveFileSplit only unsigned int getRegionFileIndex() { return data.regionIndex; } // When using ConsoleSaveFileSplit only @@ -185,7 +185,7 @@ protected: vector<FileEntry *> *getDatFilesWithMacAndUserID(const PlayerUID& pUID); vector<FileEntry *> *getDatFilesWithPrimaryUser(); #endif - + void setSaveVersion(int version) { m_saveVersion = version; } int getSaveVersion() { return m_saveVersion; } void setOriginalSaveVersion(int version) { m_originalSaveVersion = version; } @@ -199,5 +199,5 @@ protected: void setEndian(ByteOrder endian) { m_saveEndian = endian; } static ByteOrder getEndian(ESavePlatform plat); bool isLocalEndianDifferent(ESavePlatform plat){return m_localEndian != getEndian(plat); } - + }; diff --git a/Minecraft.World/FileInputStream.cpp b/Minecraft.World/FileInputStream.cpp index 5e0f6ca5..7c0e844f 100644 --- a/Minecraft.World/FileInputStream.cpp +++ b/Minecraft.World/FileInputStream.cpp @@ -164,8 +164,8 @@ void FileInputStream::close() { //printf("\n\nFileInputStream::close - TRYING TO CLOSE AN INVALID FILE HANDLE\n\n"); return; - } - + } + BOOL result = CloseHandle( m_fileHandle ); if( result == 0 ) @@ -185,7 +185,7 @@ void FileInputStream::close() //n - the number of bytes to be skipped. //Returns: //the actual number of bytes skipped. -int64_t FileInputStream::skip(int64_t n) +__int64 FileInputStream::skip(__int64 n) { #ifdef _XBOX LARGE_INTEGER li; diff --git a/Minecraft.World/FileInputStream.h b/Minecraft.World/FileInputStream.h index 99ce776f..e855a2d7 100644 --- a/Minecraft.World/FileInputStream.h +++ b/Minecraft.World/FileInputStream.h @@ -12,7 +12,7 @@ public: virtual int read(byteArray b); virtual int read(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual int64_t skip(int64_t n); + virtual __int64 skip(__int64 n); private: HANDLE m_fileHandle; diff --git a/Minecraft.World/FlatLevelSource.cpp b/Minecraft.World/FlatLevelSource.cpp index 96b53312..6435bfb4 100644 --- a/Minecraft.World/FlatLevelSource.cpp +++ b/Minecraft.World/FlatLevelSource.cpp @@ -11,7 +11,7 @@ //FlatLevelSource::villageFeature = new VillageFeature(1); -FlatLevelSource::FlatLevelSource(Level *level, int64_t seed, bool generateStructures) +FlatLevelSource::FlatLevelSource(Level *level, __int64 seed, bool generateStructures) { m_XZSize = level->getLevelData()->getXZSize(); @@ -32,26 +32,26 @@ FlatLevelSource::~FlatLevelSource() delete villageFeature; } -void FlatLevelSource::prepareHeights(byteArray blocks) +void FlatLevelSource::prepareHeights(byteArray blocks) { int height = blocks.length / (16 * 16); - for (int xc = 0; xc < 16; xc++) + for (int xc = 0; xc < 16; xc++) { - for (int zc = 0; zc < 16; zc++) + for (int zc = 0; zc < 16; zc++) { - for (int yc = 0; yc < height; yc++) + for (int yc = 0; yc < height; yc++) { int block = 0; - if (yc == 0) + if (yc == 0) { block = Tile::unbreakable_Id; - } - else if (yc <= 2) + } + else if (yc <= 2) { block = Tile::dirt_Id; - } - else if (yc == 3) + } + else if (yc == 3) { block = Tile::grass_Id; } @@ -61,12 +61,12 @@ void FlatLevelSource::prepareHeights(byteArray blocks) } } -LevelChunk *FlatLevelSource::create(int x, int z) +LevelChunk *FlatLevelSource::create(int x, int z) { return getChunk(x, z); } -LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs) +LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs) { // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int chunksSize = Level::genDepth * 16 * 16; @@ -80,7 +80,7 @@ LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs) // double[] temperatures = level.getBiomeSource().temperatures; - if (generateStructures) + if (generateStructures) { villageFeature->apply(this, level, xOffs, zOffs, blocks); } @@ -96,43 +96,43 @@ LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs) } -bool FlatLevelSource::hasChunk(int x, int y) +bool FlatLevelSource::hasChunk(int x, int y) { return true; } -void FlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt) +void FlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt) { // 4J - changed from random to pprandom so we can run in parallel with getChunk etc. pprandom->setSeed(level->getSeed()); - int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; - int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); - if (generateStructures) + if (generateStructures) { villageFeature->postProcess(level, pprandom, xt, zt); } - + app.processSchematics(parent->getChunk(xt,zt)); } -bool FlatLevelSource::save(bool force, ProgressListener *progressListener) +bool FlatLevelSource::save(bool force, ProgressListener *progressListener) { return true; } -bool FlatLevelSource::tick() +bool FlatLevelSource::tick() { return false; } -bool FlatLevelSource::shouldSave() +bool FlatLevelSource::shouldSave() { return true; } -wstring FlatLevelSource::gatherStats() +wstring FlatLevelSource::gatherStats() { return L"FlatLevelSource"; } @@ -140,7 +140,7 @@ wstring FlatLevelSource::gatherStats() vector<Biome::MobSpawnerData *> *FlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == NULL) { return NULL; } diff --git a/Minecraft.World/FlatLevelSource.h b/Minecraft.World/FlatLevelSource.h index 0c15c9d9..804a7b5a 100644 --- a/Minecraft.World/FlatLevelSource.h +++ b/Minecraft.World/FlatLevelSource.h @@ -24,13 +24,13 @@ private: boolean generateStructures; VillageFeature *villageFeature;// = new VillageFeature(1); -public: - FlatLevelSource(Level *level, int64_t seed, bool generateStructures); +public: + FlatLevelSource(Level *level, __int64 seed, bool generateStructures); ~FlatLevelSource(); -private: void prepareHeights(byteArray blocks); +private: void prepareHeights(byteArray blocks); -public: +public: virtual LevelChunk *create(int x, int z); virtual LevelChunk *getChunk(int xOffs, int zOffs); virtual bool hasChunk(int x, int y); diff --git a/Minecraft.World/FuzzyZoomLayer.cpp b/Minecraft.World/FuzzyZoomLayer.cpp index 54155ff5..65c6709e 100644 --- a/Minecraft.World/FuzzyZoomLayer.cpp +++ b/Minecraft.World/FuzzyZoomLayer.cpp @@ -2,7 +2,7 @@ #include "System.h" #include "net.minecraft.world.level.newbiome.layer.h" -FuzzyZoomLayer::FuzzyZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +FuzzyZoomLayer::FuzzyZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } @@ -61,7 +61,7 @@ int FuzzyZoomLayer::random(int a, int b, int c, int d) return d; } -shared_ptr<Layer>FuzzyZoomLayer::zoom(int64_t seed, shared_ptr<Layer>sup, int count) +shared_ptr<Layer>FuzzyZoomLayer::zoom(__int64 seed, shared_ptr<Layer>sup, int count) { shared_ptr<Layer> result = sup; for (int i = 0; i < count; i++) diff --git a/Minecraft.World/FuzzyZoomLayer.h b/Minecraft.World/FuzzyZoomLayer.h index 19526931..bc8f5e48 100644 --- a/Minecraft.World/FuzzyZoomLayer.h +++ b/Minecraft.World/FuzzyZoomLayer.h @@ -5,7 +5,7 @@ class FuzzyZoomLayer : public Layer { public: - FuzzyZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent); + FuzzyZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent); intArray getArea(int xo, int yo, int w, int h); protected: @@ -13,5 +13,5 @@ protected: int random(int a, int b, int c, int d); public: - static shared_ptr<Layer>zoom(int64_t seed, shared_ptr<Layer>sup, int count); + static shared_ptr<Layer>zoom(__int64 seed, shared_ptr<Layer>sup, int count); };
\ No newline at end of file diff --git a/Minecraft.World/GZIPInputStream.h b/Minecraft.World/GZIPInputStream.h index b9242576..f852518b 100644 --- a/Minecraft.World/GZIPInputStream.h +++ b/Minecraft.World/GZIPInputStream.h @@ -13,5 +13,5 @@ public: virtual int read(byteArray b) { return stream->read( b ); }; virtual int read(byteArray b, unsigned int offset, unsigned int length) { return stream->read(b, offset, length); }; virtual void close() { return stream->close(); }; - virtual int64_t skip(int64_t n) { return 0; }; + virtual __int64 skip(__int64 n) { return 0; }; };
\ No newline at end of file diff --git a/Minecraft.World/GrowMushroomIslandLayer.cpp b/Minecraft.World/GrowMushroomIslandLayer.cpp index d204502d..14857366 100644 --- a/Minecraft.World/GrowMushroomIslandLayer.cpp +++ b/Minecraft.World/GrowMushroomIslandLayer.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.biome.h" -GrowMushroomIslandLayer::GrowMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup) +GrowMushroomIslandLayer::GrowMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup) { this->parent = parent; } @@ -25,10 +25,10 @@ intArray GrowMushroomIslandLayer::getArea(int xo, int yo, int w, int h) int n2 = p[(x + 2) + (y + 0) * pw]; int n3 = p[(x + 0) + (y + 2) * pw]; int n4 = p[(x + 2) + (y + 2) * pw]; - + int c = p[(x + 1) + (y + 1) * pw]; - if( ( n1 == Biome::mushroomIsland->id ) || ( n2 == Biome::mushroomIsland->id ) || ( n3 == Biome::mushroomIsland->id ) || ( n4 == Biome::mushroomIsland->id ) ) + if( ( n1 == Biome::mushroomIsland->id ) || ( n2 == Biome::mushroomIsland->id ) || ( n3 == Biome::mushroomIsland->id ) || ( n4 == Biome::mushroomIsland->id ) ) { result[x + y * w] = Biome::mushroomIsland->id; } diff --git a/Minecraft.World/GrowMushroomIslandLayer.h b/Minecraft.World/GrowMushroomIslandLayer.h index 6b0860f7..3bca4d5c 100644 --- a/Minecraft.World/GrowMushroomIslandLayer.h +++ b/Minecraft.World/GrowMushroomIslandLayer.h @@ -4,6 +4,6 @@ class GrowMushroomIslandLayer : public Layer { public: - GrowMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent); + GrowMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent); virtual intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/HellDimension.cpp b/Minecraft.World/HellDimension.cpp index 63cb0df7..85e2a25a 100644 --- a/Minecraft.World/HellDimension.cpp +++ b/Minecraft.World/HellDimension.cpp @@ -48,7 +48,7 @@ ChunkSource *HellDimension::createRandomLevelSource() const } else #endif - if (levelType == LevelType::lvl_flat) + if (levelType == LevelType::lvl_flat) { return new HellFlatLevelSource(level, level->getSeed()); } @@ -68,7 +68,7 @@ bool HellDimension::isValidSpawn(int x, int z) const return false; } -float HellDimension::getTimeOfDay(int64_t time, float a) const +float HellDimension::getTimeOfDay(__int64 time, float a) const { return 0.5f; } diff --git a/Minecraft.World/HellDimension.h b/Minecraft.World/HellDimension.h index fa95d9b2..b37f2b53 100644 --- a/Minecraft.World/HellDimension.h +++ b/Minecraft.World/HellDimension.h @@ -14,7 +14,7 @@ public: virtual ChunkSource *createRandomLevelSource() const; virtual bool isNaturalDimension(); virtual bool isValidSpawn(int x, int y) const; - virtual float getTimeOfDay(int64_t time, float a) const; + virtual float getTimeOfDay(__int64 time, float a) const; virtual bool mayRespawn() const; virtual bool isFoggyAt(int x, int z); diff --git a/Minecraft.World/HellFlatLevelSource.cpp b/Minecraft.World/HellFlatLevelSource.cpp index 14b29f8c..0b1c4359 100644 --- a/Minecraft.World/HellFlatLevelSource.cpp +++ b/Minecraft.World/HellFlatLevelSource.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.level.storage.h" #include "HellFlatLevelSource.h" -HellFlatLevelSource::HellFlatLevelSource(Level *level, int64_t seed) +HellFlatLevelSource::HellFlatLevelSource(Level *level, __int64 seed) { int xzSize = level->getLevelData()->getXZSize(); int hellScale = level->getLevelData()->getHellScale(); @@ -26,17 +26,17 @@ void HellFlatLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) { int height = blocks.length / (16 * 16); - for (int xc = 0; xc < 16; xc++) + for (int xc = 0; xc < 16; xc++) { - for (int zc = 0; zc < 16; zc++) + for (int zc = 0; zc < 16; zc++) { - for (int yc = 0; yc < height; yc++) + for (int yc = 0; yc < height; yc++) { int block = 0; if ( (yc <= 6) || ( yc >= 121 ) ) { block = Tile::hellRock_Id; - } + } blocks[xc << 11 | zc << 7 | yc] = (byte) block; } @@ -159,8 +159,8 @@ void HellFlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt) // we need to use a separate random - have used the same initialisation code as used in RandomLevelSource::postProcess to make sure this random value // is consistent for each world generation. Also changed all uses of random here to pprandom. pprandom->setSeed(level->getSeed()); - int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; - int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); int count = pprandom->nextInt(pprandom->nextInt(10) + 1) + 1; @@ -211,7 +211,7 @@ wstring HellFlatLevelSource::gatherStats() vector<Biome::MobSpawnerData *> *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == NULL) { return NULL; } diff --git a/Minecraft.World/HellFlatLevelSource.h b/Minecraft.World/HellFlatLevelSource.h index c1bd5868..b756d9a6 100644 --- a/Minecraft.World/HellFlatLevelSource.h +++ b/Minecraft.World/HellFlatLevelSource.h @@ -26,7 +26,7 @@ private: Level *level; public: - HellFlatLevelSource(Level *level, int64_t seed); + HellFlatLevelSource(Level *level, __int64 seed); ~HellFlatLevelSource(); private: diff --git a/Minecraft.World/HellRandomLevelSource.cpp b/Minecraft.World/HellRandomLevelSource.cpp index 3d67d0f8..10194f7d 100644 --- a/Minecraft.World/HellRandomLevelSource.cpp +++ b/Minecraft.World/HellRandomLevelSource.cpp @@ -7,7 +7,7 @@ #include "BiomeSource.h" #include "HellRandomLevelSource.h" -HellRandomLevelSource::HellRandomLevelSource(Level *level, int64_t seed) +HellRandomLevelSource::HellRandomLevelSource(Level *level, __int64 seed) { int xzSize = level->getLevelData()->getXZSize(); int hellScale = level->getLevelData()->getHellScale(); @@ -224,7 +224,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks if(random->nextInt(16) == 0) { top = (byte) Tile::netherStalk_Id; - + // Place the nether wart on top of the soul sand y += 1; int genDepthMinusOne = Level::genDepthMinusOne; // Take into local int for PS4 as min takes a reference to the const int there and then needs the value to exist for the linker @@ -430,8 +430,8 @@ void HellRandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt) // we need to use a separate random - have used the same initialisation code as used in RandomLevelSource::postProcess to make sure this random value // is consistent for each world generation. Also changed all uses of random here to pprandom. pprandom->setSeed(level->getSeed()); - int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; - int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); netherBridgeFeature->postProcess(level, pprandom, xt, zt); @@ -497,7 +497,7 @@ void HellRandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt) } HeavyTile::instaFall = false; - + app.processSchematics(parent->getChunk(xt,zt)); } diff --git a/Minecraft.World/HellRandomLevelSource.h b/Minecraft.World/HellRandomLevelSource.h index 634d1828..0587e86a 100644 --- a/Minecraft.World/HellRandomLevelSource.h +++ b/Minecraft.World/HellRandomLevelSource.h @@ -37,7 +37,7 @@ private: Level *level; public: - HellRandomLevelSource(Level *level, int64_t seed); + HellRandomLevelSource(Level *level, __int64 seed); ~HellRandomLevelSource(); NetherBridgeFeature *netherBridgeFeature; @@ -68,5 +68,5 @@ public: wstring gatherStats(); virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/InputStream.h b/Minecraft.World/InputStream.h index 234e85b5..af0ff593 100644 --- a/Minecraft.World/InputStream.h +++ b/Minecraft.World/InputStream.h @@ -11,7 +11,7 @@ public: virtual int read(byteArray b) = 0; virtual int read(byteArray b, unsigned int offset, unsigned int length) = 0; virtual void close() = 0; - virtual int64_t skip(int64_t n) = 0; + virtual __int64 skip(__int64 n) = 0; static InputStream *getResourceAsStream(const wstring &fileName); };
\ No newline at end of file diff --git a/Minecraft.World/IslandLayer.cpp b/Minecraft.World/IslandLayer.cpp index 0a6cc3fa..b502f384 100644 --- a/Minecraft.World/IslandLayer.cpp +++ b/Minecraft.World/IslandLayer.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "net.minecraft.world.level.newbiome.layer.h" -IslandLayer::IslandLayer(int64_t seedMixup) : Layer(seedMixup) +IslandLayer::IslandLayer(__int64 seedMixup) : Layer(seedMixup) { } diff --git a/Minecraft.World/IslandLayer.h b/Minecraft.World/IslandLayer.h index 90995636..09e90eb3 100644 --- a/Minecraft.World/IslandLayer.h +++ b/Minecraft.World/IslandLayer.h @@ -5,7 +5,7 @@ class IslandLayer : public Layer { public: - IslandLayer(int64_t seedMixup); + IslandLayer(__int64 seedMixup); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/JavaMath.cpp b/Minecraft.World/JavaMath.cpp index 87778c56..92843695 100644 --- a/Minecraft.World/JavaMath.cpp +++ b/Minecraft.World/JavaMath.cpp @@ -34,9 +34,9 @@ double Math::random() //a - a floating-point value to be rounded to a long. //Returns: //the value of the argument rounded to the nearest long value. -int64_t Math::round( double d ) +__int64 Math::round( double d ) { - return (int64_t)floor( d + 0.5 ); + return (__int64)floor( d + 0.5 ); } int Math::_max(int a, int b) @@ -59,7 +59,7 @@ float Math::_min(float a, float b) return a < b ? a : b; } -float Math::wrapDegrees(float input) +float Math::wrapDegrees(float input) { while(input>=360.0f)input-=360.0f; if (input >= 180.0f) input -= 360.0f; @@ -67,7 +67,7 @@ float Math::wrapDegrees(float input) return input; } -double Math::wrapDegrees(double input) +double Math::wrapDegrees(double input) { while(input>=360.0)input-=360.0; if (input >= 180.0) input -= 360.0; diff --git a/Minecraft.World/JavaMath.h b/Minecraft.World/JavaMath.h index b64832e9..fcd095c8 100644 --- a/Minecraft.World/JavaMath.h +++ b/Minecraft.World/JavaMath.h @@ -8,7 +8,7 @@ private: public: static double random(); - static int64_t round( double d ); + static __int64 round( double d ); static int _max(int a, int b); static float _max(float a, float b); static int _min(int a, int b); diff --git a/Minecraft.World/LargeCaveFeature.cpp b/Minecraft.World/LargeCaveFeature.cpp index 4db3ca3a..20b83a30 100644 --- a/Minecraft.World/LargeCaveFeature.cpp +++ b/Minecraft.World/LargeCaveFeature.cpp @@ -4,12 +4,12 @@ #include "net.minecraft.world.level.biome.h" #include "LargeCaveFeature.h" -void LargeCaveFeature::addRoom(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom) +void LargeCaveFeature::addRoom(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom) { addTunnel(seed, xOffs, zOffs, blocks, xRoom, yRoom, zRoom, 1 + random->nextFloat() * 6, 0, 0, -1, -1, 0.5); } -void LargeCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale) +void LargeCaveFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale) { double xMid = xOffs * 16 + 8; double zMid = zOffs * 16 + 8; @@ -123,7 +123,7 @@ void LargeCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray b } if (detectedWater) continue; - for (int xx = x0; xx < x1; xx++) + for (int xx = x0; xx < x1; xx++) { double xd = ((xx + xOffs * 16 + 0.5) - xCave) / rad; for (int zz = z0; zz < z1; zz++) @@ -142,7 +142,7 @@ void LargeCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray b if (block == Tile::grass_Id) hasGrass = true; if (block == Tile::rock_Id || block == Tile::dirt_Id || block == Tile::grass_Id) { - if (yy < 10) + if (yy < 10) { blocks[p] = (byte) Tile::lava_Id; } diff --git a/Minecraft.World/LargeCaveFeature.h b/Minecraft.World/LargeCaveFeature.h index 66eadde9..5188aca7 100644 --- a/Minecraft.World/LargeCaveFeature.h +++ b/Minecraft.World/LargeCaveFeature.h @@ -5,7 +5,7 @@ class LargeCaveFeature : public LargeFeature { protected: - void addRoom(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom); - void addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale); + void addRoom(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom); + void addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale); virtual void addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks); }; diff --git a/Minecraft.World/LargeFeature.cpp b/Minecraft.World/LargeFeature.cpp index 23dc532f..2e43fac7 100644 --- a/Minecraft.World/LargeFeature.cpp +++ b/Minecraft.World/LargeFeature.cpp @@ -21,15 +21,15 @@ void LargeFeature::apply(ChunkSource *ChunkSource, Level *level, int xOffs, int this->level = level; random->setSeed(level->getSeed()); - int64_t xScale = random->nextLong(); - int64_t zScale = random->nextLong(); + __int64 xScale = random->nextLong(); + __int64 zScale = random->nextLong(); for (int x = xOffs - r; x <= xOffs + r; x++) { for (int z = zOffs - r; z <= zOffs + r; z++) { - int64_t xx = x * xScale; - int64_t zz = z * zScale; + __int64 xx = x * xScale; + __int64 zz = z * zScale; random->setSeed(xx ^ zz ^ level->getSeed()); addFeature(level, x, z, xOffs, zOffs, blocks); } diff --git a/Minecraft.World/Layer.cpp b/Minecraft.World/Layer.cpp index ca805912..1d010e72 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -16,7 +16,7 @@ libdivide::divider<long long> fast_d7(7); libdivide::divider<long long> fast_d10(10); #endif -LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) +LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType) { // 4J - Some changes moved here from 1.2.3. Temperature & downfall layers are no longer created & returned, and a debug layer is isn't. // For reference with regard to future merging, things NOT brought forward from the 1.2.3 version are new layer types that we @@ -58,7 +58,7 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) biomeLayer = shared_ptr<Layer>(new ZoomLayer(1000 + i, biomeLayer)); if (i == 0) biomeLayer = shared_ptr<Layer>(new AddIslandLayer(3, biomeLayer)); - + if (i == 0) { // 4J - moved mushroom islands to here. This skips 3 zooms that the old location of the add was, making them about 1/8 of the original size. Adding @@ -68,13 +68,13 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) } if (i == 1 ) - { + { // 4J - now expand mushroom islands up again. This does a simple region grow to add a new mushroom island element when any of the neighbours are also mushroom islands. // This helps make the islands into nice compact shapes of the type that are actually likely to be able to make an island out of the sea in a small space. Also // helps the shore layer from doing too much damage in shrinking the islands we are making - biomeLayer = shared_ptr<Layer>(new GrowMushroomIslandLayer(5, biomeLayer)); + biomeLayer = shared_ptr<Layer>(new GrowMushroomIslandLayer(5, biomeLayer)); // Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does - biomeLayer = shared_ptr<Layer>(new ShoreLayer(1000, biomeLayer)); + biomeLayer = shared_ptr<Layer>(new ShoreLayer(1000, biomeLayer)); biomeLayer = shared_ptr<Layer>(new SwampRiversLayer(1000, biomeLayer)); } @@ -107,7 +107,7 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) return result; } -Layer::Layer(int64_t seedMixup) +Layer::Layer(__int64 seedMixup) { parent = nullptr; @@ -120,7 +120,7 @@ Layer::Layer(int64_t seedMixup) this->seedMixup += seedMixup; } -void Layer::init(int64_t seed) +void Layer::init(__int64 seed) { this->seed = seed; if (parent != NULL) parent->init(seed); @@ -132,7 +132,7 @@ void Layer::init(int64_t seed) this->seed += seedMixup; } -void Layer::initRandom(int64_t x, int64_t y) +void Layer::initRandom(__int64 x, __int64 y) { rval = seed; rval *= rval * 6364136223846793005l + 1442695040888963407l; diff --git a/Minecraft.World/Layer.h b/Minecraft.World/Layer.h index 6f31e94a..a444a629 100644 --- a/Minecraft.World/Layer.h +++ b/Minecraft.World/Layer.h @@ -11,22 +11,22 @@ class LevelType; class Layer { private: - int64_t seed; + __int64 seed; protected: shared_ptr<Layer>parent; private: - int64_t rval; - int64_t seedMixup; + __int64 rval; + __int64 seedMixup; public: - static LayerArray getDefaultLayers(int64_t seed, LevelType *levelType); + static LayerArray getDefaultLayers(__int64 seed, LevelType *levelType); - Layer(int64_t seedMixup); + Layer(__int64 seedMixup); - virtual void init(int64_t seed); - virtual void initRandom(int64_t x, int64_t y); + virtual void init(__int64 seed); + virtual void initRandom(__int64 x, __int64 y); protected: int nextRandom(int max); diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index c159ecb8..4b6a64f5 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -112,7 +112,7 @@ void Level::initCache(lightCache_t *cache) } // Set a brightness value, going through the cache if enabled for this thread -void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness) +void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness) { if( cache == NULL ) { @@ -129,8 +129,8 @@ void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) | - ( ( ((uint64_t)z) & 0x3FFFC00L) << 22); + posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) | + ( ( ((__uint64)z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -188,8 +188,8 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) | - ( ( ((uint64_t)z) & 0x3FFFC00L) << 22); + posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) | + ( ( ((__uint64)z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -255,8 +255,8 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( ((uint64_t)x) & 0x3FFFC00) << 38) | - ( ( ((uint64_t)z) & 0x3FFFC00) << 22); + posbits |= ( ( ((__uint64)x) & 0x3FFFC00) << 38) | + ( ( ((__uint64)z) & 0x3FFFC00) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -285,7 +285,7 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i #endif setBrightness(LightLayer::Block, xx, yy, zz, val, true); } - + // Update both emission & blocking values whilst we are here cacheValue = posbits | EMISSION_VALID | BLOCKING_VALID; int t = getTile(x,y,z); @@ -331,8 +331,8 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) | - ( ( ((uint64_t)z) & 0x3FFFC00L) << 22); + posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) | + ( ( ((__uint64)z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -361,7 +361,7 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay #endif setBrightness(layer, xx, yy, zz, val, true); } - + // Update both emission & blocking values whilst we are here cacheValue = posbits | EMISSION_VALID | BLOCKING_VALID; int t = getTile(x,y,z); @@ -394,7 +394,7 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay // this hasn't been updated (for client threads) for each individual lighting update as would have been the case with the non-cached lighting. There's two reasons for this // (1) it's more efficient, since we aren't doing so many individual calls to the level listener to let the renderer know what has been updated // (2) it lets the lighting actually complete before we get any visual representation of the update, otherwise we end up seeing some strange partial updates -void Level::flushCache(lightCache_t *cache, uint64_t cacheUse, LightLayer::variety layer) +void Level::flushCache(lightCache_t *cache, __uint64 cacheUse, LightLayer::variety layer) { // cacheUse has a single bit for each x, y and z to say whether anything with that x, y or z has been written to if( cacheUse == 0 ) return; @@ -596,7 +596,7 @@ Level::Level(Level *level, Dimension *dimension) this->levelData = new LevelData(level->levelData); if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels this->savedDataStorage = new SavedDataStorage( levelStorage.get() ); - + shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); if (savedVillages == NULL) { @@ -660,7 +660,7 @@ void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName //{ // dimension = Dimension::getNew(levelData->getDimension()); //} - else + else { dimension = Dimension::getNew(0); } @@ -676,7 +676,7 @@ void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels ((Dimension *) dimension)->init( this ); - + chunkSource = doCreateChunkSource ? createChunkSource() : NULL; // 4J - added flag so chunk source can be called from derived class instead // 4J Stu- Moved to derived classes @@ -707,7 +707,7 @@ Level::~Level() DeleteCriticalSection(&m_checkLightCS); // 4J-PB - savedDataStorage is shared between overworld and nether levels in the server, so it will already have been deleted on the first level delete - if(savedDataStorage!=NULL) delete savedDataStorage; + if(savedDataStorage!=NULL) delete savedDataStorage; DeleteCriticalSection(&m_entitiesCS); DeleteCriticalSection(&m_tileEntityListCS); @@ -1298,7 +1298,7 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z) // the level chunk once void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z) { - if( ( ( ( x & 15 ) == 0 ) || ( ( x & 15 ) == 15 ) ) || + if( ( ( ( x & 15 ) == 0 ) || ( ( x & 15 ) == 15 ) ) || ( ( ( z & 15 ) == 0 ) || ( ( z & 15 ) == 15 ) ) || ( ( y <= 0 ) || ( y >= 127 ) ) ) { @@ -1591,7 +1591,7 @@ void Level::playSound(shared_ptr<Entity> entity, int iSound, float volume, float if(entity->GetType() == eTYPE_SERVERPLAYER) { //app.DebugPrintf("ENTITY is serverplayer\n"); - + (*it)->playSound(entity,iSound, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch); } else @@ -1630,7 +1630,7 @@ void Level::playMusic(double x, double y, double z, const wstring& string, float { } -// 4J removed - +// 4J removed - /* void Level::addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd) { @@ -2255,7 +2255,7 @@ void Level::tickEntities() { entityRemoved(*it); } - // + // entitiesToRemove.clear(); //for (int i = 0; i < entities.size(); i++) @@ -2268,7 +2268,7 @@ void Level::tickEntities() for (unsigned int i = 0; i < entities.size(); ) { shared_ptr<Entity> e = entities.at(i); - + if (e->riding != NULL) { if (e->riding->removed || e->riding->rider.lock() != e) @@ -2287,7 +2287,7 @@ void Level::tickEntities() { #ifndef _FINAL_BUILD if(!( app.DebugSettingsOn() && app.GetMobsDontTickEnabled() && (dynamic_pointer_cast<Mob>(e) != NULL) && (dynamic_pointer_cast<Player>(e) == NULL))) -#endif +#endif { tick(e); } @@ -2360,7 +2360,7 @@ void Level::tickEntities() // 4J-PB - Stuart - check this is correct here if (!tileEntitiesToUnload.empty()) - { + { //tileEntityList.removeAll(tileEntitiesToUnload); for( AUTO_VAR(it, tileEntityList.begin()); it != tileEntityList.end(); ) @@ -2767,7 +2767,7 @@ shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks) { shared_ptr<Explosion> explosion = shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) ); - explosion->fire = fire; + explosion->fire = fire; explosion->destroyBlocks = destroyBlocks; explosion->explode(); explosion->finalizeExplosion(true); @@ -2945,7 +2945,7 @@ bool Level::isSolidRenderTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; if (tile == NULL) return false; - + // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by // other leaves (or solid things). This is paired with another change in Tile::getTexture which makes such solid tiles actually visibly solid (these @@ -3008,7 +3008,7 @@ bool Level::isTopSolidBlocking(int x, int y, int z) if (tile == NULL) return false; if (tile->material->isSolidBlocking() && tile->isCubeShaped()) return true; - if (dynamic_cast<StairTile *>(tile) != NULL) + if (dynamic_cast<StairTile *>(tile) != NULL) { return (getData(x, y, z) & StairTile::UPSIDEDOWN_BIT) == StairTile::UPSIDEDOWN_BIT; } @@ -3159,7 +3159,7 @@ void Level::toggleDownfall() void Level::buildAndPrepareChunksToPoll() { -#if 0 +#if 0 AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { @@ -3205,7 +3205,7 @@ void Level::buildAndPrepareChunksToPoll() delete [] xx; delete [] zz; #endif - + if (delayUntilNextMoodSound > 0) delayUntilNextMoodSound--; // 4J Stu - Added 1.2.3, but not sure if we want to do it @@ -3387,7 +3387,7 @@ inline int GetIndex(int x, int y, int z) void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive) { lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache); - uint64_t cacheUse = 0; + __uint64 cacheUse = 0; if( force ) { @@ -3416,7 +3416,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f EnterCriticalSection(&m_checkLightCS); #ifdef __PSVITA__ - // AP - only clear the one array element required to check if something has changed + // AP - only clear the one array element required to check if something has changed cachewritten = false; if( cache != NULL ) { @@ -3450,7 +3450,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f #endif // If we're in cached mode, then use memory allocated after the cached data itself for the toCheck array, in an attempt to make both that & the other cached data sit on the CPU L2 cache better. - + int *toCheck; if( cache == NULL ) { @@ -3477,7 +3477,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f // Lock 128K of cache (containing all the lighting cache + first 112K of toCheck array) on L2 to try and stop any cached data getting knocked out of L2 by other non-cached reads (or vice-versa) // if( cache ) XLockL2(XLOCKL2_INDEX_TITLE, cache, 128 * 1024, XLOCKL2_LOCK_SIZE_1_WAY, 0 ); - + { int cc = getBrightnessCached(cache, layer, xc, yc, zc); int ex = 0; @@ -3713,7 +3713,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f ///////////////////////////////////////////////////////////////// #endif LeaveCriticalSection(&m_checkLightCS); - + } @@ -3905,7 +3905,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { shared_ptr<Entity> e = *it;//entities.at(i); - + float sd = e->distanceTo(x,y,z); if (sd * sd > range * range) { @@ -4149,7 +4149,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(shared_ptr<Entity> source, shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist) { double best = -1; - + shared_ptr<Player> result = nullptr; AUTO_VAR(itEnd, players.end()); for (AUTO_VAR(it, players.begin()); it != itEnd; it++) @@ -4179,7 +4179,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double } visibleDist *= (.7f * coverPercentage); } - + // 4J Stu - Added check that this player is still alive and privilege check if ((visibleDist < 0 || dist < visibleDist * visibleDist) && (best == -1 || dist < best) && p->isAlive() && !p->hasInvisiblePrivilege()) { @@ -4318,16 +4318,16 @@ void Level::checkSession() } -void Level::setTime(int64_t time) +void Level::setTime(__int64 time) { // 4J : WESTY : Added to track game time played by players for other awards. if (time != 0) // Ignore setting time to 0, done at level start and during tutorial. { // Determine step in time and ensure it is reasonable ( we only have an int to store the player stat). - int64_t timeDiff = time - levelData->getTime(); - + __int64 timeDiff = time - levelData->getTime(); + // debug setting added to keep it at day time -#ifndef _FINAL_BUILD +#ifndef _FINAL_BUILD if(app.DebugSettingsOn()) { if(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_FreezeTime)) @@ -4363,18 +4363,18 @@ void Level::setTime(int64_t time) this->levelData->setTime(time); } -void Level::setOverrideTimeOfDay(int64_t time) +void Level::setOverrideTimeOfDay(__int64 time) { m_timeOfDayOverride = time; } -int64_t Level::getSeed() +__int64 Level::getSeed() { return levelData->getSeed(); } -int64_t Level::getTime() +__int64 Level::getTime() { return levelData->getTime(); } @@ -4529,7 +4529,7 @@ int Level::getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int ce return savedDataStorage->getAuxValueForMap(xuid, dimension, centreXC, centreZC, scale); } -// void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data) +// void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data) // { // auto itEnd = listeners.end(); // for (auto it = listeners.begin(); it != itEnd; it++) @@ -4565,7 +4565,7 @@ int Level::getHeight() Random *Level::getRandomFor(int x, int z, int blend) { - int64_t seed = (x * 341873128712l + z * 132897987541l) + getLevelData()->getSeed() + blend; + __int64 seed = (x * 341873128712l + z * 132897987541l) + getLevelData()->getSeed() + blend; random->setSeed(seed); return random; } @@ -4585,9 +4585,9 @@ bool Level::isAllEmpty() return false; } -double Level::getHorizonHeight() +double Level::getHorizonHeight() { - if (levelData->getGenerator() == LevelType::lvl_flat) + if (levelData->getGenerator() == LevelType::lvl_flat) { return 0.0; } diff --git a/Minecraft.World/Level.h b/Minecraft.World/Level.h index ecafc02b..361a40e8 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/Level.h @@ -133,7 +133,7 @@ public: Random *random; bool isNew; Dimension *dimension; - + protected: vector<LevelListener *> listeners; @@ -239,26 +239,26 @@ public: void setBrightnessNoUpdateOnClient(LightLayer::variety layer, int x, int y, int z, int brightness); // 4J added #ifdef _LARGE_WORLDS - typedef uint64_t lightCache_t; + typedef __uint64 lightCache_t; #else typedef unsigned int lightCache_t; #endif - inline void setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness); + inline void setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness); inline int getBrightnessCached(lightCache_t *cache, LightLayer::variety layer, int x, int y, int z); inline int getEmissionCached(lightCache_t *cache, int ct, int x, int y, int z); inline int getBlockingCached(lightCache_t *cache, LightLayer::variety layer, int *ct, int x, int y, int z); void initCache(lightCache_t *cache); - void flushCache(lightCache_t *cache, uint64_t cacheUse, LightLayer::variety layer); + void flushCache(lightCache_t *cache, __uint64 cacheUse, LightLayer::variety layer); bool cachewritten; static const int LIGHTING_SHIFT = 24; static const int BLOCKING_SHIFT = 20; static const int EMISSION_SHIFT = 16; #ifdef _LARGE_WORLDS - static const int64_t LIGHTING_WRITEBACK = 0x80000000LL; - static const int64_t EMISSION_VALID = 0x40000000LL; - static const int64_t BLOCKING_VALID = 0x20000000LL; - static const int64_t LIGHTING_VALID = 0x10000000LL; + static const __int64 LIGHTING_WRITEBACK = 0x80000000LL; + static const __int64 EMISSION_VALID = 0x40000000LL; + static const __int64 BLOCKING_VALID = 0x20000000LL; + static const __int64 LIGHTING_VALID = 0x10000000LL; static const lightCache_t POSITION_MASK = 0xffffffff0000ffffLL; #else static const int LIGHTING_WRITEBACK = 0x80000000; @@ -402,7 +402,7 @@ public: bool shouldSnow(int x, int y, int z); void checkLight(int x, int y, int z, bool force = false, bool rootOnlyEmissive = false); // 4J added force, rootOnlySource parameters private: - int *toCheckLevel; + int *toCheckLevel; int getExpectedSkyColor(lightCache_t *cache, int oc, int x, int y , int z, int ct, int block); int getExpectedBlockColor(lightCache_t *cache, int oc, int x, int y, int z, int ct, int block, bool propagatedOnly); // 4J added parameter public: @@ -449,10 +449,10 @@ public: void setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, byteArray data, bool includeLighting = true); virtual void disconnect(bool sendDisconnect = true); void checkSession(); - void setTime(int64_t time); - void setOverrideTimeOfDay(int64_t time); // 4J Added so we can override timeOfDay without changing tick time - int64_t getSeed(); - int64_t getTime(); + void setTime(__int64 time); + void setOverrideTimeOfDay(__int64 time); // 4J Added so we can override timeOfDay without changing tick time + __int64 getSeed(); + __int64 getTime(); Pos *getSharedSpawnPos(); void setSpawnPos(int x, int y, int z); void setSpawnPos(Pos *spawnPos); @@ -496,7 +496,7 @@ public: // 4J added - int64_t m_timeOfDayOverride; + __int64 m_timeOfDayOverride; // 4J - optimisation - keep direct reference of underlying cache here LevelChunk **chunkSourceCache; diff --git a/Minecraft.World/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp index 332f12f5..823c7c4c 100644 --- a/Minecraft.World/LevelChunk.cpp +++ b/Minecraft.World/LevelChunk.cpp @@ -51,7 +51,7 @@ void LevelChunk::init(Level *level, int x, int z) biomes = byteArray(16 * 16); for(int i = 0; i < 16 * 16; i++ ) { - biomes[i] = 0xff; + biomes[i] = 0xff; } #ifdef _ENTITIES_RW_SECTION EnterCriticalRWSection(&m_csEntities, true); @@ -103,12 +103,12 @@ void LevelChunk::init(Level *level, int x, int z) // Optimisation brought forward from 1.8.2, change from int to unsigned char & this special value changed from -999 to 255 for(int i = 0; i < 16 * 16; i++ ) { - rainHeights[i] = 255; + rainHeights[i] = 255; } // 4J - lighting change brought forward from 1.8.2, introduced an array of bools called gapsToRecheck, which are now a single bit in array of nybble flags in this version for(int i = 0; i < 8 * 16; i++ ) { - columnFlags[i] = 0; + columnFlags[i] = 0; } // 4J added - to flag if any emissive tile has been added to this chunk (will be cleared when lighting has been successfully completed for this chunk). Defaulting to true @@ -183,7 +183,7 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) : ENTITY_BL // skyLight = new DataLayer(blocks.length, level->depthBits); // blockLight = new DataLayer(blocks.length, level->depthBits); - if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) + if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { if(blocks.length > Level::COMPRESSED_CHUNK_SECTION_TILES) upperBlocks = new CompressedTileStorage(blocks,Level::COMPRESSED_CHUNK_SECTION_TILES); else upperBlocks = new CompressedTileStorage(true); @@ -388,7 +388,7 @@ void LevelChunk::startSharingTilesAndData(int forceMs) else { // Only force if it has been more than forceMs milliseconds since we last wanted to unshare this chunk - int64_t timenow = System::currentTimeMillis(); + __int64 timenow = System::currentTimeMillis(); if( ( timenow - lastUnsharedTime ) < forceMs ) { LeaveCriticalSection(&m_csSharing); @@ -551,7 +551,7 @@ void LevelChunk::recalcHeightmap() { int y = Level::maxBuildHeight - 1; // int p = x << level->depthBitsPlusFour | z << level->depthBits; // 4J - removed - + #ifdef __PSVITA__ int Index = ( x << 11 ) + ( z << 7 ); int offset = Level::COMPRESSED_CHUNK_SECTION_TILES; @@ -656,7 +656,7 @@ void LevelChunk::recalcHeightmap() void LevelChunk::lightLava() { if( !emissiveAdded ) return; - + for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) { @@ -697,7 +697,7 @@ void LevelChunk::recheckGaps(bool bForce) // 4J added - otherwise we can end up doing a very broken kind of lighting since for an empty chunk, the heightmap is all zero, but it // still has an x and z of 0 which means that the level->getHeightmap references in here find a real chunk near the origin, and then attempt // to light massive gaps between the height of 0 and whatever heights are in those. - if( isEmpty() ) return; + if( isEmpty() ) return; // 4J added int minXZ = - (level->dimension->getXZSize() * 16 ) / 2; @@ -765,7 +765,7 @@ void LevelChunk::lightGap(int x, int z, int source) { lightGap(x, z, source, height + 1); } - else if (height < source) + else if (height < source) { lightGap(x, z, height, source + 1); } @@ -793,7 +793,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) if (yStart > yOld) y = yStart; // int p = x << level->depthBitsPlusFour | z << level->depthBits; // 4J - removed - + CompressedTileStorage *blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks; while (y > 0 && Tile::lightBlock[blocks->get(x,(y-1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT,z) & 0xff] == 0) // 4J - blocks->get() was blocks[p + y - 1] { @@ -845,7 +845,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) } int br = 15; - + SparseLightStorage *skyLight = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT? upperSkyLight : lowerSkyLight; while (y > 0 && br > 0) { @@ -891,7 +891,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) /** * The purpose of this method is to allow the EmptyLevelChunk to be all air * but still block light. See EmptyLevelChunk.java -* +* * @param x * @param y * @param z @@ -921,7 +921,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) } int oldHeight = heightmap[slot] & 0xff; - + CompressedTileStorage *blocks = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks : lowerBlocks; SparseDataStorage *data = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperData : lowerData; int old = blocks->get(x,y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT,z); @@ -1116,12 +1116,12 @@ void LevelChunk::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety brightnesses[5] = light->get(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z + 1); } - + if( layer == LightLayer::Sky ) light = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperSkyLight : lowerSkyLight; else light = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlockLight : lowerBlockLight; if(light) brightnesses[2] = light->get(x, (y - 1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z); - + if( layer == LightLayer::Sky ) light = (y+1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperSkyLight : lowerSkyLight; else light = (y+1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlockLight : lowerBlockLight; if(light) brightnesses[3] = light->get(x, (y + 1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z); @@ -1227,7 +1227,7 @@ void LevelChunk::removeEntity(shared_ptr<Entity> e, int yc) // 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; } @@ -1282,7 +1282,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z) int t = getTile(x, y, z); if (t <= 0 || !Tile::tiles[t]->isEntityTile()) return nullptr; - + // 4J-PB changed from this in 1.7.3 //EntityTile *et = (EntityTile *) Tile::tiles[t]; //et->onPlace(level, this->x * 16 + x, y, this->z * 16 + z); @@ -1316,7 +1316,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z) LeaveCriticalSection(&m_csTileEntities); return nullptr; } - + return tileEntity; } @@ -1631,7 +1631,7 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<shared for (int yc = yc0; yc <= yc1; yc++) { vector<shared_ptr<Entity> > *entities = entityBlocks[yc]; - + AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { @@ -1879,7 +1879,7 @@ void LevelChunk::setCheckAllLight() checkLightPosition = 0; } -Random *LevelChunk::getRandom(int64_t l) +Random *LevelChunk::getRandom(__int64 l) { return new Random((level->getSeed() + x * x * 4987142 + x * 5947611 + z * z * 4392871l + z * 389711) ^ l); } @@ -2130,7 +2130,7 @@ void LevelChunk::setSkyLightDataAllBright() void LevelChunk::compressLighting() { // The lighting data is now generally not shared between host & local client, but is for a while at the start of level creation (until the point where the chunk data would be transferred by network - // data for remote clients). We'll therefore either be compressing a shared copy here or one of the server or client copies depending on + // data for remote clients). We'll therefore either be compressing a shared copy here or one of the server or client copies depending on lowerSkyLight->compress(); upperSkyLight->compress(); lowerBlockLight->compress(); @@ -2400,7 +2400,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA int y1 = y0 + ys; unsigned int tileCount = xs * ys * zs; unsigned int halfTileCount = tileCount/2; - + int sectionHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; int lowerYSpan = min(y1, sectionHeight) - y0; int upperYSpan = ys - lowerYSpan; @@ -2439,7 +2439,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA //setBlocksAndData(*data, x0, y0, z0, x1, y1, z1, p); //// If it is a full chunk, we'll need to rearrange into the order the rest of the game expects - //if( xs == 16 && ys == 128 && zs == 16 && ( ( x & 15 ) == 0 ) && ( y == 0 ) && ( ( z & 15 ) == 0 ) ) + //if( xs == 16 && ys == 128 && zs == 16 && ( ( x & 15 ) == 0 ) && ( y == 0 ) && ( ( z & 15 ) == 0 ) ) //{ // byteArray newBuffer = byteArray(81920); // for( int x = 0; x < 16; x++ ) diff --git a/Minecraft.World/LevelChunk.h b/Minecraft.World/LevelChunk.h index 820835c3..e9510ad5 100644 --- a/Minecraft.World/LevelChunk.h +++ b/Minecraft.World/LevelChunk.h @@ -102,13 +102,13 @@ public: unordered_map<TilePos, shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq> tileEntities; vector<shared_ptr<Entity> > **entityBlocks; - + static const int sTerrainPopulatedFromHere = 2; static const int sTerrainPopulatedFromW = 4; static const int sTerrainPopulatedFromS = 8; static const int sTerrainPopulatedFromSW = 16; static const int sTerrainPopulatedAllAffecting = 30; // All the post-processing that can actually place tiles in this chunk are complete - static const int sTerrainPopulatedFromNW = 32; + static const int sTerrainPopulatedFromNW = 32; static const int sTerrainPopulatedFromN = 64; static const int sTerrainPopulatedFromNE = 128; static const int sTerrainPopulatedFromE = 256; @@ -134,8 +134,8 @@ public: void stopSharingTilesAndData(); // 4J added virtual void reSyncLighting(); // 4J added void startSharingTilesAndData(int forceMs = 0); // 4J added - int64_t lastUnsharedTime; // 4J added - int64_t lastSaveTime; + __int64 lastUnsharedTime; // 4J added + __int64 lastSaveTime; bool seenByPlayer; #ifdef _LARGE_WORLDS @@ -213,7 +213,7 @@ public: virtual bool testSetBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p); // 4J added virtual void setCheckAllLight(); - virtual Random *getRandom(int64_t l); + virtual Random *getRandom(__int64 l); virtual bool isEmpty(); virtual void attemptCompression(); @@ -238,9 +238,9 @@ public: byteArray getBiomes(); void setBiomes(byteArray biomes); bool biomeHasRain(int x, int z); // 4J added - bool biomeHasSnow(int x, int z); // 4J added + bool biomeHasSnow(int x, int z); // 4J added private: - void updateBiomeFlags(int x, int z); // 4J added + void updateBiomeFlags(int x, int z); // 4J added public: void compressLighting(); // 4J added void compressBlocks(); // 4J added diff --git a/Minecraft.World/LevelData.cpp b/Minecraft.World/LevelData.cpp index 486fbe98..026dca70 100644 --- a/Minecraft.World/LevelData.cpp +++ b/Minecraft.World/LevelData.cpp @@ -14,18 +14,18 @@ LevelData::LevelData(CompoundTag *tag) { seed = tag->getLong(L"RandomSeed"); m_pGenerator = LevelType::lvl_normal; - if (tag->contains(L"generatorName")) + if (tag->contains(L"generatorName")) { wstring generatorName = tag->getString(L"generatorName"); m_pGenerator = LevelType::getLevelType(generatorName); - if (m_pGenerator == NULL) + if (m_pGenerator == NULL) { m_pGenerator = LevelType::lvl_normal; - } - else if (m_pGenerator->hasReplacement()) + } + else if (m_pGenerator->hasReplacement()) { int generatorVersion = 0; - if (tag->contains(L"generatorVersion")) + if (tag->contains(L"generatorVersion")) { generatorVersion = tag->getInt(L"generatorVersion"); } @@ -80,7 +80,7 @@ LevelData::LevelData(CompoundTag *tag) hasBeenInCreative = tag->getBoolean(L"hasBeenInCreative"); // 4J added so we can not award achievements to levels modified in creative // 4J added - for stronghold position - bStronghold = tag->getBoolean(L"hasStronghold"); + bStronghold = tag->getBoolean(L"hasStronghold"); if(bStronghold==false) { @@ -95,7 +95,7 @@ LevelData::LevelData(CompoundTag *tag) } // 4J added - for stronghold end portal position - bStrongholdEndPortal = tag->getBoolean(L"hasStrongholdEndPortal"); + bStrongholdEndPortal = tag->getBoolean(L"hasStrongholdEndPortal"); if(bStrongholdEndPortal==false) { @@ -111,7 +111,7 @@ LevelData::LevelData(CompoundTag *tag) // 4J Added m_xzSize = tag->getInt(L"XZSize"); m_hellScale = tag->getInt(L"HellScale"); - + m_xzSize = min(m_xzSize,LEVEL_MAX_WIDTH); m_xzSize = max(m_xzSize,LEVEL_MIN_WIDTH); @@ -126,20 +126,20 @@ LevelData::LevelData(CompoundTag *tag) } /* 4J - we don't store this anymore - if (tag->contains(L"Player")) + if (tag->contains(L"Player")) { loadedPlayerTag = tag->getCompound(L"Player"); dimension = loadedPlayerTag->getInt(L"Dimension"); } else - { + { this->loadedPlayerTag = NULL; } */ dimension = 0; } -LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) +LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) { this->seed = levelSettings->getSeed(); this->gameType = levelSettings->getGameType(); @@ -149,7 +149,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) this->m_pGenerator = levelSettings->getLevelType(); this->hardcore = levelSettings->isHardcore(); - // 4J Stu - Default initers + // 4J Stu - Default initers this->xSpawn = 0; this->ySpawn = 0; this->zSpawn = 0; @@ -179,7 +179,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) this->bStrongholdEndPortal = false; m_xzSize = levelSettings->getXZSize(); m_hellScale = levelSettings->getHellScale(); - + m_xzSize = min(m_xzSize,LEVEL_MAX_WIDTH); m_xzSize = max(m_xzSize,LEVEL_MIN_WIDTH); @@ -243,13 +243,13 @@ CompoundTag *LevelData::createTag() return tag; } -CompoundTag *LevelData::createTag(vector<shared_ptr<Player> > *players) +CompoundTag *LevelData::createTag(vector<shared_ptr<Player> > *players) { // 4J - removed all code for storing tags for players return createTag(); } -void LevelData::setTagData(CompoundTag *tag) +void LevelData::setTagData(CompoundTag *tag) { tag->putLong(L"RandomSeed", seed); tag->putString(L"generatorName", m_pGenerator->getGeneratorName()); @@ -287,17 +287,17 @@ void LevelData::setTagData(CompoundTag *tag) tag->putInt(L"HellScale", m_hellScale); } -int64_t LevelData::getSeed() +__int64 LevelData::getSeed() { return seed; } -int LevelData::getXSpawn() +int LevelData::getXSpawn() { return xSpawn; } -int LevelData::getYSpawn() +int LevelData::getYSpawn() { return ySpawn; } @@ -307,7 +307,7 @@ int LevelData::getZSpawn() return zSpawn; } -int LevelData::getXStronghold() +int LevelData::getXStronghold() { return xStronghold; } @@ -318,7 +318,7 @@ int LevelData::getZStronghold() return zStronghold; } -int LevelData::getXStrongholdEndPortal() +int LevelData::getXStrongholdEndPortal() { return xStrongholdEndPortal; } @@ -329,12 +329,12 @@ int LevelData::getZStrongholdEndPortal() return zStrongholdEndPortal; } -int64_t LevelData::getTime() +__int64 LevelData::getTime() { return time; } -int64_t LevelData::getSizeOnDisk() +__int64 LevelData::getSizeOnDisk() { return sizeOnDisk; } @@ -350,7 +350,7 @@ CompoundTag *LevelData::getLoadedPlayerTag() // return dimension; //} -void LevelData::setSeed(int64_t seed) +void LevelData::setSeed(__int64 seed) { this->seed = seed; } @@ -360,7 +360,7 @@ void LevelData::setXSpawn(int xSpawn) this->xSpawn = xSpawn; } -void LevelData::setYSpawn(int ySpawn) +void LevelData::setYSpawn(int ySpawn) { this->ySpawn = ySpawn; } @@ -411,12 +411,12 @@ void LevelData::setZStrongholdEndPortal(int zStrongholdEndPortal) this->zStrongholdEndPortal = zStrongholdEndPortal; } -void LevelData::setTime(int64_t time) +void LevelData::setTime(__int64 time) { this->time = time; } -void LevelData::setSizeOnDisk(int64_t sizeOnDisk) +void LevelData::setSizeOnDisk(__int64 sizeOnDisk) { this->sizeOnDisk = sizeOnDisk; } @@ -428,7 +428,7 @@ void LevelData::setLoadedPlayerTag(CompoundTag *loadedPlayerTag) } // 4J Remove TU9 as it's never used -//void LevelData::setDimension(int dimension) +//void LevelData::setDimension(int dimension) //{ // this->dimension = dimension; //} @@ -440,7 +440,7 @@ void LevelData::setSpawn(int xSpawn, int ySpawn, int zSpawn) this->zSpawn = zSpawn; } -wstring LevelData::getLevelName() +wstring LevelData::getLevelName() { return levelName; } @@ -450,7 +450,7 @@ void LevelData::setLevelName(const wstring& levelName) this->levelName = levelName; } -int LevelData::getVersion() +int LevelData::getVersion() { return version; } @@ -460,7 +460,7 @@ void LevelData::setVersion(int version) this->version = version; } -int64_t LevelData::getLastPlayed() +__int64 LevelData::getLastPlayed() { return lastPlayed; } @@ -485,7 +485,7 @@ void LevelData::setThunderTime(int thunderTime) this->thunderTime = thunderTime; } -bool LevelData::isRaining() +bool LevelData::isRaining() { return raining; } @@ -543,12 +543,12 @@ void LevelData::setHasBeenInCreative(bool value) hasBeenInCreative = value; } -LevelType *LevelData::getGenerator() +LevelType *LevelData::getGenerator() { return m_pGenerator; } -void LevelData::setGenerator(LevelType *generator) +void LevelData::setGenerator(LevelType *generator) { m_pGenerator = generator; } diff --git a/Minecraft.World/LevelData.h b/Minecraft.World/LevelData.h index 405ba1b8..0afe9be2 100644 --- a/Minecraft.World/LevelData.h +++ b/Minecraft.World/LevelData.h @@ -11,14 +11,14 @@ class LevelData { friend class DerivedLevelData; private: - int64_t seed; + __int64 seed; LevelType *m_pGenerator;// = LevelType.normal; int xSpawn; int ySpawn; int zSpawn; - int64_t time; - int64_t lastPlayed; - int64_t sizeOnDisk; + __int64 time; + __int64 lastPlayed; + __int64 sizeOnDisk; // CompoundTag *loadedPlayerTag; // 4J removed int dimension; wstring levelName; @@ -71,7 +71,7 @@ protected: virtual void setTagData(CompoundTag *tag); // 4J - removed CompoundTag *playerTag public: - virtual int64_t getSeed(); + virtual __int64 getSeed(); virtual int getXSpawn(); virtual int getYSpawn(); virtual int getZSpawn(); @@ -79,11 +79,11 @@ public: virtual int getZStronghold(); virtual int getXStrongholdEndPortal(); virtual int getZStrongholdEndPortal(); - virtual int64_t getTime(); - virtual int64_t getSizeOnDisk(); + virtual __int64 getTime(); + virtual __int64 getSizeOnDisk(); virtual CompoundTag *getLoadedPlayerTag(); //int getDimension(); // 4J Removed TU 9 as it's never accurate - virtual void setSeed(int64_t seed); + virtual void setSeed(__int64 seed); virtual void setXSpawn(int xSpawn); virtual void setYSpawn(int ySpawn); virtual void setZSpawn(int zSpawn); @@ -96,8 +96,8 @@ public: virtual void setXStrongholdEndPortal(int xStrongholdEndPortal); virtual void setZStrongholdEndPortal(int zStrongholdEndPortal); - virtual void setTime(int64_t time); - virtual void setSizeOnDisk(int64_t sizeOnDisk); + virtual void setTime(__int64 time); + virtual void setSizeOnDisk(__int64 sizeOnDisk); virtual void setLoadedPlayerTag(CompoundTag *loadedPlayerTag); //void setDimension(int dimension); // 4J Removed TU 9 as it's never used virtual void setSpawn(int xSpawn, int ySpawn, int zSpawn); @@ -105,7 +105,7 @@ public: virtual void setLevelName(const wstring& levelName); virtual int getVersion(); virtual void setVersion(int version); - virtual int64_t getLastPlayed(); + virtual __int64 getLastPlayed(); virtual bool isThundering(); virtual void setThundering(bool thundering); virtual int getThunderTime(); diff --git a/Minecraft.World/LevelSettings.cpp b/Minecraft.World/LevelSettings.cpp index 1af62626..59faa1ca 100644 --- a/Minecraft.World/LevelSettings.cpp +++ b/Minecraft.World/LevelSettings.cpp @@ -85,7 +85,7 @@ GameType *GameType::byName(const wstring &name) return SURVIVAL; } -void LevelSettings::_init(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale) +void LevelSettings::_init(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale) { this->seed = seed; this->gameType = gameType; @@ -99,11 +99,11 @@ void LevelSettings::_init(int64_t seed, GameType *gameType, bool generateMapFeat m_hellScale = hellScale; } -LevelSettings::LevelSettings(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale) : - seed(seed), - gameType(gameType), +LevelSettings::LevelSettings(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale) : + seed(seed), + gameType(gameType), hardcore(hardcore), - generateMapFeatures(generateMapFeatures), + generateMapFeatures(generateMapFeatures), newSeaLevel(newSeaLevel), levelType(levelType), startingBonusItems(false) @@ -133,7 +133,7 @@ bool LevelSettings::hasStartingBonusItems() return startingBonusItems; } -int64_t LevelSettings::getSeed() +__int64 LevelSettings::getSeed() { return seed; } @@ -148,7 +148,7 @@ bool LevelSettings::isHardcore() return hardcore; } -LevelType *LevelSettings::getLevelType() +LevelType *LevelSettings::getLevelType() { return levelType; } diff --git a/Minecraft.World/LevelSettings.h b/Minecraft.World/LevelSettings.h index 2de2330a..c183df8c 100644 --- a/Minecraft.World/LevelSettings.h +++ b/Minecraft.World/LevelSettings.h @@ -35,7 +35,7 @@ public: class LevelSettings { private: - int64_t seed; + __int64 seed; GameType *gameType; bool generateMapFeatures; bool hardcore; @@ -46,15 +46,15 @@ private: int m_xzSize; // 4J Added int m_hellScale; - void _init(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param + void _init(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param public: - LevelSettings(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param + LevelSettings(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param LevelSettings(LevelData *levelData); LevelSettings *enableStartingBonusItems(); // 4J - brought forward from 1.3.2 LevelSettings *enableSinglePlayerCommands(); bool hasStartingBonusItems(); // 4J - brought forward from 1.3.2 - int64_t getSeed(); + __int64 getSeed(); GameType *getGameType(); bool isHardcore(); LevelType *getLevelType(); diff --git a/Minecraft.World/LevelSummary.cpp b/Minecraft.World/LevelSummary.cpp index 915abaf6..d8e7ddee 100644 --- a/Minecraft.World/LevelSummary.cpp +++ b/Minecraft.World/LevelSummary.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "LevelSummary.h" -LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, int64_t lastPlayed, int64_t sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats) : +LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats) : levelId( levelId ), levelName( levelName ), lastPlayed( lastPlayed ), @@ -13,7 +13,7 @@ LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, int { } -wstring LevelSummary::getLevelId() +wstring LevelSummary::getLevelId() { return levelId; } @@ -23,28 +23,28 @@ wstring LevelSummary::getLevelName() return levelName; } -int64_t LevelSummary::getSizeOnDisk() +__int64 LevelSummary::getSizeOnDisk() { return sizeOnDisk; } -bool LevelSummary::isRequiresConversion() +bool LevelSummary::isRequiresConversion() { return requiresConversion; } -int64_t LevelSummary::getLastPlayed() +__int64 LevelSummary::getLastPlayed() { return lastPlayed; } -int LevelSummary::compareTo(LevelSummary *rhs) +int LevelSummary::compareTo(LevelSummary *rhs) { if (lastPlayed < rhs->lastPlayed) { return 1; } - if (lastPlayed > rhs->lastPlayed) + if (lastPlayed > rhs->lastPlayed) { return -1; } diff --git a/Minecraft.World/LevelSummary.h b/Minecraft.World/LevelSummary.h index ce5699a2..bbf391ff 100644 --- a/Minecraft.World/LevelSummary.h +++ b/Minecraft.World/LevelSummary.h @@ -7,20 +7,20 @@ class LevelSummary { const wstring levelId; const wstring levelName; - const int64_t lastPlayed; - const int64_t sizeOnDisk; + const __int64 lastPlayed; + const __int64 sizeOnDisk; const bool requiresConversion; GameType *gameMode; const bool hardcore; const bool _hasCheats; public: - LevelSummary(const wstring& levelId, const wstring& levelName, int64_t lastPlayed, int64_t sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats); + LevelSummary(const wstring& levelId, const wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats); wstring getLevelId(); wstring getLevelName(); - int64_t getSizeOnDisk(); + __int64 getSizeOnDisk(); bool isRequiresConversion(); - int64_t getLastPlayed(); + __int64 getLastPlayed(); int compareTo(LevelSummary *rhs); GameType *getGameMode(); bool isHardcore(); diff --git a/Minecraft.World/LightningBolt.h b/Minecraft.World/LightningBolt.h index 2a14e88a..28d5e004 100644 --- a/Minecraft.World/LightningBolt.h +++ b/Minecraft.World/LightningBolt.h @@ -16,7 +16,7 @@ private: int life; public: - int64_t seed; + __int64 seed; private: int flashes; diff --git a/Minecraft.World/LoginPacket.cpp b/Minecraft.World/LoginPacket.cpp index 44ed62b3..bfe69226 100644 --- a/Minecraft.World/LoginPacket.cpp +++ b/Minecraft.World/LoginPacket.cpp @@ -66,7 +66,7 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID o } // Server -> Client -LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, int64_t seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale) +LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale) { this->userName = userName; this->clientVersion = clientVersion; @@ -94,13 +94,13 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType * m_hellScale = hellScale; } -void LoginPacket::read(DataInputStream *dis) //throws IOException +void LoginPacket::read(DataInputStream *dis) //throws IOException { clientVersion = dis->readInt(); userName = readUtf(dis, Player::MAX_NAME_LENGTH); wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); - if (m_pLevelType == NULL) + if (m_pLevelType == NULL) { m_pLevelType = LevelType::lvl_normal; } @@ -131,15 +131,15 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException } -void LoginPacket::write(DataOutputStream *dos) //throws IOException +void LoginPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(clientVersion); writeUtf(userName, dos); - if (m_pLevelType == NULL) + if (m_pLevelType == NULL) { writeUtf(L"", dos); - } - else + } + else { writeUtf(m_pLevelType->getGeneratorName(), dos); } @@ -171,13 +171,13 @@ void LoginPacket::handle(PacketListener *listener) listener->handleLogin(shared_from_this()); } -int LoginPacket::getEstimatedSize() +int LoginPacket::getEstimatedSize() { int length=0; - if (m_pLevelType != NULL) + if (m_pLevelType != NULL) { length = (int)m_pLevelType->getGeneratorName().length(); } - return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); + return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); } diff --git a/Minecraft.World/LoginPacket.h b/Minecraft.World/LoginPacket.h index bf7164fa..09041135 100644 --- a/Minecraft.World/LoginPacket.h +++ b/Minecraft.World/LoginPacket.h @@ -9,10 +9,10 @@ class LoginPacket : public Packet, public enable_shared_from_this<LoginPacket> public: int clientVersion; wstring userName; - int64_t seed; + __int64 seed; char dimension; PlayerUID m_offlineXuid, m_onlineXuid; // 4J Added - char difficulty; // 4J Added + char difficulty; // 4J Added bool m_friendsOnlyUGC; // 4J Added DWORD m_ugcPlayersVersion; // 4J Added INT m_multiplayerInstanceId; //4J Added for sentient @@ -31,7 +31,7 @@ public: BYTE maxPlayers; LoginPacket(); - LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, int64_t seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client + LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client LoginPacket(const wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest); // Client -> Server virtual void read(DataInputStream *dis); diff --git a/Minecraft.World/LongTag.h b/Minecraft.World/LongTag.h index b957ec6d..2dcd3819 100644 --- a/Minecraft.World/LongTag.h +++ b/Minecraft.World/LongTag.h @@ -4,10 +4,10 @@ class LongTag : public Tag { public: - int64_t data; + __int64 data; LongTag(const wstring &name) : Tag(name) {} - LongTag(const wstring &name, int64_t data) : Tag(name) {this->data = data; } - + LongTag(const wstring &name, __int64 data) : Tag(name) {this->data = data; } + void write(DataOutput *dos) { dos->writeLong(data); } void load(DataInput *dis) { data = dis->readLong(); } diff --git a/Minecraft.World/McRegionChunkStorage.cpp b/Minecraft.World/McRegionChunkStorage.cpp index 8075bc80..a11cb1c1 100644 --- a/Minecraft.World/McRegionChunkStorage.cpp +++ b/Minecraft.World/McRegionChunkStorage.cpp @@ -32,7 +32,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstr m_saveFile->createFile(ConsoleSavePath(L"r.-1.0.mcr")); } - + #ifdef SPLIT_SAVES ConsoleSavePath currentFile = ConsoleSavePath( m_prefix + wstring( L"entities.dat" ) ); @@ -45,7 +45,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstr for(int i = 0; i < count; ++i) { - int64_t index = dis.readLong(); + __int64 index = dis.readLong(); CompoundTag *tag = NbtIo::read(&dis); ByteArrayOutputStream bos; @@ -78,7 +78,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) // 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) { - int64_t index = ((int64_t)(x) << 32) | (((int64_t)(z))&0x00000000FFFFFFFF); + __int64 index = ((__int64)(x) << 32) | (((__int64)(z))&0x00000000FFFFFFFF); AUTO_VAR(it, m_entityData.find(index)); if(it != m_entityData.end()) @@ -235,7 +235,7 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk) { #ifdef SPLIT_SAVES PIXBeginNamedEvent(0,"Saving entities"); - int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z))&0x00000000FFFFFFFF); + __int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF); delete m_entityData[index].data; @@ -269,8 +269,8 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk) void McRegionChunkStorage::loadEntities(Level *level, LevelChunk *levelChunk) { #ifdef SPLIT_SAVES - int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z))&0x00000000FFFFFFFF); - + __int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF); + AUTO_VAR(it, m_entityData.find(index)); if(it != m_entityData.end()) { diff --git a/Minecraft.World/McRegionChunkStorage.h b/Minecraft.World/McRegionChunkStorage.h index 47ae1c99..50dabd52 100644 --- a/Minecraft.World/McRegionChunkStorage.h +++ b/Minecraft.World/McRegionChunkStorage.h @@ -16,7 +16,7 @@ private: ConsoleSaveFile *m_saveFile; static CRITICAL_SECTION cs_memory; - unordered_map<int64_t, byteArray> m_entityData; + unordered_map<__int64, byteArray> m_entityData; static std::deque<DataOutputStream *> s_chunkDataQueue; static int s_runningThreadCount; diff --git a/Minecraft.World/Mth.cpp b/Minecraft.World/Mth.cpp index 3b5412ad..eccd828e 100644 --- a/Minecraft.World/Mth.cpp +++ b/Minecraft.World/Mth.cpp @@ -50,9 +50,9 @@ int Mth::floor(float v) return v < i ? i - 1 : i; } -int64_t Mth::lfloor(double v) +__int64 Mth::lfloor(double v) { - int64_t i = (int64_t) v; + __int64 i = (__int64) v; return v < i ? i - 1 : i; } diff --git a/Minecraft.World/Mth.h b/Minecraft.World/Mth.h index 78c3ef10..17119fb1 100644 --- a/Minecraft.World/Mth.h +++ b/Minecraft.World/Mth.h @@ -22,7 +22,7 @@ public : static float sqrt(float x); static float sqrt(double x); static int floor(float v); - static int64_t lfloor(double v); + static __int64 lfloor(double v); static int fastFloor(double x); static int floor(double v); static int absFloor(double v); diff --git a/Minecraft.World/NbtSlotFile.cpp b/Minecraft.World/NbtSlotFile.cpp index 0d679897..81880cfb 100644 --- a/Minecraft.World/NbtSlotFile.cpp +++ b/Minecraft.World/NbtSlotFile.cpp @@ -4,7 +4,7 @@ byteArray NbtSlotFile::READ_BUFFER(1024*1024); -int64_t NbtSlotFile::largest = 0; +__int64 NbtSlotFile::largest = 0; NbtSlotFile::NbtSlotFile(File file) { @@ -144,12 +144,12 @@ int NbtSlotFile::getFreeSlot() // fileSlot = toReplace->back(); // toReplace->pop_back(); // } else - + if (freeFileSlots.size() > 0) { fileSlot = freeFileSlots.back(); freeFileSlots.pop_back(); - } + } else { fileSlot = totalFileSlots++; @@ -164,7 +164,7 @@ void NbtSlotFile::replaceSlot(int slot, vector<CompoundTag *> *tags) DWORD numberOfBytesWritten; toReplace = fileSlotMap[slot]; fileSlotMap[slot] = new vector<int>(); - + AUTO_VAR(itEndTags, tags->end()); for (AUTO_VAR(it, tags->begin()); it != itEndTags; it++) { @@ -227,7 +227,7 @@ void NbtSlotFile::replaceSlot(int slot, vector<CompoundTag *> *tags) } delete[] compressed.data; } - + AUTO_VAR(itEndToRep, toReplace->end()); for (AUTO_VAR(it, toReplace->begin()); it != itEndToRep; it++) { diff --git a/Minecraft.World/NbtSlotFile.h b/Minecraft.World/NbtSlotFile.h index c717c657..93b4fe57 100644 --- a/Minecraft.World/NbtSlotFile.h +++ b/Minecraft.World/NbtSlotFile.h @@ -19,7 +19,7 @@ private: int fileSlotMapLength; vector<int> freeFileSlots; int totalFileSlots; - static int64_t largest; + static __int64 largest; public: NbtSlotFile(File file); diff --git a/Minecraft.World/NotGateTile.cpp b/Minecraft.World/NotGateTile.cpp index d9fc35a7..a3971284 100644 --- a/Minecraft.World/NotGateTile.cpp +++ b/Minecraft.World/NotGateTile.cpp @@ -121,7 +121,7 @@ void NotGateTile::tick(Level *level, int x, int y, int z, Random *random) } } - if (on) + if (on) { if (neighborSignal) { @@ -152,7 +152,7 @@ void NotGateTile::tick(Level *level, int x, int y, int z, Random *random) level->setTileAndData(x, y, z, Tile::notGate_on_Id, level->getData(x, y, z)); } else - { + { app.DebugPrintf("Torch at (%d,%d,%d) has toggled too many times\n",x,y,z); } } @@ -221,7 +221,7 @@ int NotGateTile::cloneTileId(Level *level, int x, int y, int z) return Tile::notGate_on_Id; } -void NotGateTile::levelTimeChanged(Level *level, int64_t delta, int64_t newTime) +void NotGateTile::levelTimeChanged(Level *level, __int64 delta, __int64 newTime) { deque<Toggle> *toggles = recentToggles[level]; diff --git a/Minecraft.World/NotGateTile.h b/Minecraft.World/NotGateTile.h index ea0aac1e..52dd4a2e 100644 --- a/Minecraft.World/NotGateTile.h +++ b/Minecraft.World/NotGateTile.h @@ -19,9 +19,9 @@ public: { public: int x, y, z; - int64_t when; + __int64 when; - Toggle(int x, int y, int z, int64_t when) + Toggle(int x, int y, int z, __int64 when) { this->x = x; this->y = y; @@ -61,7 +61,7 @@ public: public: void animateTick(Level *level, int xt, int yt, int zt, Random *random); int cloneTileId(Level *level, int x, int y, int z); - void levelTimeChanged(Level *level, int64_t delta, int64_t newTime); + void levelTimeChanged(Level *level, __int64 delta, __int64 newTime); void registerIcons(IconRegister *iconRegister); };
\ No newline at end of file diff --git a/Minecraft.World/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index c1515c12..50c29a96 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/OldChunkStorage.cpp @@ -103,7 +103,7 @@ File OldChunkStorage::getFile(int x, int z) file = File( file, wstring( name ) ); if ( !file.exists() ) { - if (!create) + if (!create) { return File(L""); } @@ -163,7 +163,7 @@ void OldChunkStorage::save(Level *level, LevelChunk *levelChunk) { LevelData *levelData = level->getLevelData(); levelData->setSizeOnDisk( levelData->getSizeOnDisk() - file.length() ); - } + } // 4J - removed try/catch // try { @@ -202,7 +202,7 @@ bool OldChunkStorage::saveEntities(LevelChunk *lc, Level *level, CompoundTag *ta lc->lastSaveHadEntities = false; ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>(); - + #ifdef _ENTITIES_RW_SECTION EnterCriticalRWSection(&lc->m_csEntities, true); #else @@ -263,7 +263,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) #ifndef SPLIT_SAVES saveEntities(lc, level, tag); #endif - + PIXBeginNamedEvent(0,"Saving tile entities"); ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>(); @@ -283,7 +283,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) vector<TickNextTickData > *ticksInChunk = level->fetchTicksInChunk(lc, false); if (ticksInChunk != NULL) { - int64_t levelTime = level->getTime(); + __int64 levelTime = level->getTime(); ListTag<CompoundTag> *tickTags = new ListTag<CompoundTag>(); for( int i = 0; i < ticksInChunk->size(); i++ ) @@ -372,7 +372,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) vector<TickNextTickData > *ticksInChunk = level->fetchTicksInChunk(lc, false); if (ticksInChunk != NULL) { - int64_t levelTime = level->getTime(); + __int64 levelTime = level->getTime(); ListTag<CompoundTag> *tickTags = new ListTag<CompoundTag>(); for( int i = 0; i < ticksInChunk->size(); i++ ) @@ -442,7 +442,7 @@ LevelChunk *OldChunkStorage::load(Level *level, DataInputStream *dis) dis->readFully(levelChunk->heightmap); - levelChunk->terrainPopulated = dis->readShort(); + levelChunk->terrainPopulated = dis->readShort(); // If all neighbours have been post-processed, then we should have done the post-post-processing now. Check that this is set as if it isn't then we won't be able // to send network data for chunks, and we won't ever try and set it again as all the directional flags are now already set - should only be an issue for old maps // before this flag was added. @@ -512,13 +512,13 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag) if( tag->get(L"TerrainPopulated") ) { // Java bool type or byte bitfield - levelChunk->terrainPopulated = tag->getByte(L"TerrainPopulated"); + levelChunk->terrainPopulated = tag->getByte(L"TerrainPopulated"); if( levelChunk->terrainPopulated >= 1 ) levelChunk->terrainPopulated = LevelChunk::sTerrainPopulatedAllNeighbours | LevelChunk::sTerrainPostPostProcessed; // Convert from old bool type to new bitfield } else { // New style short - levelChunk->terrainPopulated = tag->getShort(L"TerrainPopulatedFlags"); + levelChunk->terrainPopulated = tag->getShort(L"TerrainPopulatedFlags"); // If all neighbours have been post-processed, then we should have done the post-post-processing now. Check that this is set as if it isn't then we won't be able // to send network data for chunks, and we won't ever try and set it again as all the directional flags are now already set - should only be an issue for old maps // before this flag was added. diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp index 8bac8629..0a59204c 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -30,7 +30,7 @@ void Packet::staticCtor() map(8, true, false, true, true, typeid(SetHealthPacket), SetHealthPacket::create); map(9, true, true, true, false, typeid(RespawnPacket), RespawnPacket::create); - map(10, true, true, true, false, typeid(MovePlayerPacket), MovePlayerPacket::create); + map(10, true, true, true, false, typeid(MovePlayerPacket), MovePlayerPacket::create); map(11, true, true, true, true, typeid(MovePlayerPacket::Pos), MovePlayerPacket::Pos::create); map(12, true, true, true, true, typeid(MovePlayerPacket::Rot), MovePlayerPacket::Rot::create); map(13, true, true, true, true, typeid(MovePlayerPacket::PosRot), MovePlayerPacket::PosRot::create); @@ -254,7 +254,7 @@ void Packet::renderAllPacketStats() void Packet::renderAllPacketStatsKey() { -#ifndef _CONTENT_PACKAGE +#ifndef _CONTENT_PACKAGE #if PACKET_ENABLE_STAT_TRACKING Minecraft *pMinecraft = Minecraft::GetInstance(); int total = Packet::renderableStats.size(); @@ -271,9 +271,9 @@ void Packet::renderAllPacketStatsKey() #endif } -int64_t Packet::getIndexedStatValue(unsigned int samplePos, unsigned int renderableId) +__int64 Packet::getIndexedStatValue(unsigned int samplePos, unsigned int renderableId) { - int64_t val = 0; + __int64 val = 0; #ifndef _CONTENT_PACKAGE #if PACKET_ENABLE_STAT_TRACKING @@ -285,13 +285,13 @@ int64_t Packet::getIndexedStatValue(unsigned int samplePos, unsigned int rendera } -shared_ptr<Packet> Packet::getPacket(int id) +shared_ptr<Packet> Packet::getPacket(int id) { // 4J - removed try/catch // try // { return idToCreateMap[id](); - // } + // } // catch (exception e) // { // // TODO 4J JEV print stack trace, newInstance doesnt throw an exception in c++ yet. @@ -366,11 +366,11 @@ shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // th packet = getPacket(id); if (packet == NULL) assert(false);//throw new IOException(wstring(L"Bad packet id ") + _toString<int>(id)); - + //app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", packet->getId()); packet->read(dis); // } - // catch (EOFException e) + // catch (EOFException e) // { // // reached end of stream // OutputDebugString("Reached end of stream"); @@ -409,7 +409,7 @@ void Packet::writePacket(shared_ptr<Packet> packet, DataOutputStream *dos) // th void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws? { #if 0 - if (value.length() > Short::MAX_VALUE) + if (value.length() > Short::MAX_VALUE) { throw new IOException(L"String too big"); } @@ -437,7 +437,7 @@ wstring Packet::readUtf(DataInputStream *dis, int maxLength) // throws IOExcepti } wstring builder = L""; - for (int i = 0; i < stringLength; i++) + for (int i = 0; i < stringLength; i++) { wchar_t rc = dis->readChar(); builder.push_back( rc ); @@ -455,12 +455,12 @@ void Packet::PacketStatistics::addPacket(int bytes) count++; totalSize += bytes; - // 4J Added + // 4J Added countSamples[samplesPos & (512 - 1)]++; sizeSamples[samplesPos & (512 - 1)] += (unsigned int) bytes; } -int Packet::PacketStatistics::getCount() +int Packet::PacketStatistics::getCount() { return count; } @@ -489,7 +489,7 @@ void Packet::PacketStatistics::renderStats( ) #endif } -int64_t Packet::PacketStatistics::getCountSample(int samplePos) +__int64 Packet::PacketStatistics::getCountSample(int samplePos) { if(samplePos == 511) { diff --git a/Minecraft.World/Packet.h b/Minecraft.World/Packet.h index 0bafe443..60410df3 100644 --- a/Minecraft.World/Packet.h +++ b/Minecraft.World/Packet.h @@ -15,17 +15,17 @@ typedef shared_ptr<Packet> (*packetCreateFn)(); class Packet { public: - class PacketStatistics + class PacketStatistics { private: int count; int totalSize; // 4J Added - int64_t countSamples[512]; - int64_t sizeSamples[512]; + __int64 countSamples[512]; + __int64 sizeSamples[512]; int samplesPos; - int64_t firstSampleTime; + __int64 firstSampleTime; public: @@ -39,7 +39,7 @@ public: // 4J Added void renderStats(); - int64_t getCountSample(int samplePos); + __int64 getCountSample(int samplePos); wstring getLegendString(); }; @@ -58,7 +58,7 @@ public: static void map(int id, bool receiveOnClient, bool receiveOnServer, bool sendToAnyClient, bool renderStats, const type_info& clazz, packetCreateFn ); public: - const int64_t createTime; + const __int64 createTime; Packet(); @@ -84,7 +84,7 @@ public: static void renderPacketStats(int id); static void renderAllPacketStats(); static void renderAllPacketStatsKey(); - static int64_t getIndexedStatValue(unsigned int samplePos, unsigned int renderableId); + static __int64 getIndexedStatValue(unsigned int samplePos, unsigned int renderableId); private : static unordered_map<int, PacketStatistics *> statistics; diff --git a/Minecraft.World/PerlinNoise.cpp b/Minecraft.World/PerlinNoise.cpp index b4c65e55..b4fd8004 100644 --- a/Minecraft.World/PerlinNoise.cpp +++ b/Minecraft.World/PerlinNoise.cpp @@ -77,8 +77,8 @@ doubleArray PerlinNoise::getRegion(doubleArray buffer, int x, int y, int z, int double xx = x * pow * xScale; double yy = y * pow * yScale; double zz = z * pow * zScale; - int64_t xb = Mth::lfloor(xx); - int64_t zb = Mth::lfloor(zz); + __int64 xb = Mth::lfloor(xx); + __int64 zb = Mth::lfloor(zz); xx -= xb; zz -= zb; xb %= 16777216; diff --git a/Minecraft.World/Random.cpp b/Minecraft.World/Random.cpp index d4e3a545..9176bf38 100644 --- a/Minecraft.World/Random.cpp +++ b/Minecraft.World/Random.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Random.h" #include "System.h" @@ -6,19 +6,19 @@ Random::Random() { // 4J - jave now uses the system nanosecond counter added to a "seedUniquifier" to get an initial seed. Our nanosecond timer is actually only millisecond accuate, so // use QueryPerformanceCounter here instead - int64_t seed; + __int64 seed; QueryPerformanceCounter((LARGE_INTEGER *)&seed); seed += 8682522807148012LL; setSeed(seed); } -Random::Random(int64_t seed) +Random::Random(__int64 seed) { setSeed(seed); } -void Random::setSeed(int64_t s) +void Random::setSeed(__int64 s) { this->seed = (s ^ 0x5DEECE66DLL) & ((1LL << 48) - 1); haveNextNextGaussian = false; @@ -41,7 +41,7 @@ void Random::nextBytes(byte *bytes, unsigned int count) double Random::nextDouble() { - return (((int64_t)next(26) << 27) + next(27)) + return (((__int64)next(26) << 27) + next(27)) / (double)(1LL << 53); } @@ -56,7 +56,7 @@ double Random::nextGaussian() { double v1, v2, s; do - { + { v1 = 2 * nextDouble() - 1; // between -1.0 and 1.0 v2 = 2 * nextDouble() - 1; // between -1.0 and 1.0 s = v1 * v1 + v2 * v2; @@ -79,7 +79,7 @@ int Random::nextInt(int n) if ((n & -n) == n) // i.e., n is a power of 2 - return (int)(((int64_t)next(31) * n) >> 31); // 4J Stu - Made int64_t instead of long + return (int)(((__int64)next(31) * n) >> 31); // 4J Stu - Made __int64 instead of long int bits, val; do @@ -95,9 +95,9 @@ float Random::nextFloat() return next(24) / ((float)(1 << 24)); } -int64_t Random::nextLong() +__int64 Random::nextLong() { - return ((int64_t)next(32) << 32) + next(32); + return ((__int64)next(32) << 32) + next(32); } bool Random::nextBoolean() diff --git a/Minecraft.World/Random.h b/Minecraft.World/Random.h index cfb6af26..9af3a3c2 100644 --- a/Minecraft.World/Random.h +++ b/Minecraft.World/Random.h @@ -3,21 +3,21 @@ class Random { private: - int64_t seed; + __int64 seed; bool haveNextNextGaussian; double nextNextGaussian; protected: int next(int bits); public: Random(); - Random(int64_t seed); - void setSeed(int64_t s); + Random(__int64 seed); + void setSeed(__int64 s); void nextBytes(byte *bytes, unsigned int count); double nextDouble(); double nextGaussian(); int nextInt(); int nextInt(int to); float nextFloat(); - int64_t nextLong(); + __int64 nextLong(); bool nextBoolean(); };
\ No newline at end of file diff --git a/Minecraft.World/RandomLevelSource.cpp b/Minecraft.World/RandomLevelSource.cpp index 277ff1f7..4e26134a 100644 --- a/Minecraft.World/RandomLevelSource.cpp +++ b/Minecraft.World/RandomLevelSource.cpp @@ -23,7 +23,7 @@ static PerlinNoise_DataIn g_depthNoise_SPU __attribute__((__aligned__(16))); const double RandomLevelSource::SNOW_SCALE = 0.3; const double RandomLevelSource::SNOW_CUTOFF = 0.5; -RandomLevelSource::RandomLevelSource(Level *level, int64_t seed, bool generateStructures) : generateStructures( generateStructures ) +RandomLevelSource::RandomLevelSource(Level *level, __int64 seed, bool generateStructures) : generateStructures( generateStructures ) { m_XZSize = level->getLevelData()->getXZSize(); @@ -160,7 +160,7 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) const int worldSize = m_XZSize * 16; const int falloffStart = 32; // chunks away from edge were we start doing fall-off const float falloffMax = 128.0f; // max value we need to get to falloff by the edge of the map - + int xxx = ( ( xOffs * 16 ) + x + ( xc * CHUNK_WIDTH ) ); int zzz = ( ( zOffs * 16 ) + z + ( zc * CHUNK_WIDTH ) ); @@ -320,7 +320,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi run = runDepth; if (y >= waterHeight - 1) blocks[offs] = top; else blocks[offs] = material; - } + } else if (run > 0) { run--; @@ -389,7 +389,7 @@ LevelChunk *RandomLevelSource::getChunk(int xOffs, int zOffs) // addCaves(xOffs, zOffs, blocks); // addTowns(xOffs, zOffs, blocks); -// levelChunk->recalcHeightmap(); // 4J - removed & moved into its own method +// levelChunk->recalcHeightmap(); // 4J - removed & moved into its own method // 4J - this now creates compressed block data from the blocks array passed in, so moved it until after the blocks are actually finalised. We also // now need to free the passed in blocks as the LevelChunk doesn't use the passed in allocation anymore. @@ -504,7 +504,7 @@ doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y, int sss = sss * 0.9f + 0.1f; ddd = (ddd * 4 - 1) / 8.0f; - + double rdepth = (dr[pp] / 8000.0); if (rdepth < 0) rdepth = -rdepth * 0.3; rdepth = rdepth * 3.0 - 2.0; @@ -515,7 +515,7 @@ doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y, int if (rdepth < -1) rdepth = -1; rdepth = rdepth / 1.4; rdepth /= 2; - } + } else { if (rdepth > 1) rdepth = 1; @@ -652,8 +652,8 @@ void RandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt) } pprandom->setSeed(level->getSeed()); - int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; - int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); bool hasVillage = false; @@ -712,7 +712,7 @@ void RandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt) PIXBeginNamedEvent(0,"Biome decorate"); biome->decorate(level, pprandom, xo, zo); PIXEndNamedEvent(); - + app.processSchematics(parent->getChunk(xt,zt)); MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, pprandom); diff --git a/Minecraft.World/RandomLevelSource.h b/Minecraft.World/RandomLevelSource.h index b80ac6c6..d71028b1 100644 --- a/Minecraft.World/RandomLevelSource.h +++ b/Minecraft.World/RandomLevelSource.h @@ -47,7 +47,7 @@ private: floatArray pows; public: - RandomLevelSource(Level *level, int64_t seed, bool generateStructures); + RandomLevelSource(Level *level, __int64 seed, bool generateStructures); ~RandomLevelSource(); public: @@ -88,5 +88,5 @@ public: public: virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/RegionFile.cpp b/Minecraft.World/RegionFile.cpp index 5c29f94e..2cfd9078 100644 --- a/Minecraft.World/RegionFile.cpp +++ b/Minecraft.World/RegionFile.cpp @@ -19,7 +19,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) chunkTimestamps = new int[SECTOR_INTS]; memset(chunkTimestamps,0,SECTOR_BYTES); - /* 4J Jev, using files instead of strings: + /* 4J Jev, using files instead of strings: strncpy(fileName,path,MAX_PATH_SIZE); */ fileName = path; @@ -30,7 +30,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) // 4J - removed try/catch // try { - + /* 4J - Removed as _lastModifed not used and this is always failing as checking wrong thing if( path->exists() ) { @@ -45,7 +45,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) { // 4J altered - the original code used to write out 2 empty sectors here, which we don't want to do as we might be at a point where we shouldn't be touching the save file. // This now happens in insertInitialSectors when we do a first write to the region - m_bIsEmpty = true; + m_bIsEmpty = true; sizeDelta += SECTOR_BYTES * 2; } @@ -70,7 +70,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) } /* set up the available sector map */ - + int nSectors; if( m_bIsEmpty ) // 4J - added this case for our empty files that we now don't create { @@ -133,7 +133,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) void RegionFile::writeAllOffsets() // used for the file ConsoleSaveFile conversion between platforms { - if(m_bIsEmpty == false) + if(m_bIsEmpty == false) { // save all the offsets and timestamps m_saveFile->LockSaveAccess(); @@ -158,7 +158,7 @@ RegionFile::~RegionFile() m_saveFile->closeHandle( fileEntry ); } -int64_t RegionFile::lastModified() +__int64 RegionFile::lastModified() { return _lastModified; } @@ -198,9 +198,9 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was m_saveFile->LockSaveAccess(); - //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); + //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN); - + unsigned int length; unsigned int decompLength; unsigned int readDecompLength; @@ -227,7 +227,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (length > SECTOR_BYTES * numSectors) { // debugln("READ", x, z, "invalid length: " + length + " > 4096 * " + numSectors); - + m_saveFile->ReleaseSaveAccess(); return NULL; } @@ -257,7 +257,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was delete [] data; // 4J - was InflaterInputStream in here too, but we've already decompressed - DataInputStream *ret = new DataInputStream(new ByteArrayInputStream( byteArray( decomp, readDecompLength) )); + DataInputStream *ret = new DataInputStream(new ByteArrayInputStream( byteArray( decomp, readDecompLength) )); return ret; // } catch (IOException e) { @@ -269,7 +269,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was DataOutputStream *RegionFile::getChunkDataOutputStream(int x, int z) { // 4J - was DeflatorOutputStream in here too, but we've already compressed - return new DataOutputStream( new ChunkBuffer(this, x, z)); + return new DataOutputStream( new ChunkBuffer(this, x, z)); } /* write a chunk at (x,z) with length bytes of data to disk */ @@ -372,7 +372,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync * file */ // debug("SAVE", x, z, length, "grow"); - //SetFilePointer(file,0,0,FILE_END); + //SetFilePointer(file,0,0,FILE_END); m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); sectorNumber = (int)sectorFree->size(); @@ -406,12 +406,12 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength) { DWORD numberOfBytesWritten = 0; - //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); + //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data - + // 4J Stu - We need to do the compression at a level above this, where it is checking for free space compLength |= 0x80000000; // 4J - signify that this has been encoded with RLE method ( see code in getChunkDataInputStream() for matching detection of this) @@ -425,7 +425,7 @@ void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int co void RegionFile::zero(int sectorNumber, int length) { DWORD numberOfBytesWritten = 0; - //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); + //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten ); } @@ -473,7 +473,7 @@ void RegionFile::setOffset(int x, int z, int offset) DWORD numberOfBytesWritten = 0; offsets[x + z * 32] = offset; m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN ); - + m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten); } @@ -487,7 +487,7 @@ void RegionFile::setTimestamp(int x, int z, int value) DWORD numberOfBytesWritten = 0; chunkTimestamps[x + z * 32] = value; m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN ); - + m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten); } diff --git a/Minecraft.World/RegionFile.h b/Minecraft.World/RegionFile.h index 520ca6a1..0717c8c2 100644 --- a/Minecraft.World/RegionFile.h +++ b/Minecraft.World/RegionFile.h @@ -16,7 +16,7 @@ private: static const int VERSION_GZIP = 1; static const int VERSION_DEFLATE = 2; static const int VERSION_XBOX = 3; - + static const int SECTOR_BYTES = 4096; static const int SECTOR_INTS = SECTOR_BYTES / 4; @@ -31,7 +31,7 @@ private: int *chunkTimestamps; vector<bool> *sectorFree; int sizeDelta; - int64_t _lastModified; + __int64 _lastModified; bool m_bIsEmpty; // 4J added public: @@ -39,7 +39,7 @@ public: ~RegionFile(); /* the modification date of the region file when it was first opened */ - int64_t lastModified(); + __int64 lastModified(); /* gets how much the region file has grown since it was last checked */ int getSizeDelta(); diff --git a/Minecraft.World/RegionHillsLayer.cpp b/Minecraft.World/RegionHillsLayer.cpp index a1e17524..dad114b0 100644 --- a/Minecraft.World/RegionHillsLayer.cpp +++ b/Minecraft.World/RegionHillsLayer.cpp @@ -3,7 +3,7 @@ #include "IntCache.h" #include "RegionHillsLayer.h" -RegionHillsLayer::RegionHillsLayer(int64_t seed, shared_ptr<Layer> parent) : Layer(seed) +RegionHillsLayer::RegionHillsLayer(__int64 seed, shared_ptr<Layer> parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/RegionHillsLayer.h b/Minecraft.World/RegionHillsLayer.h index 5ad0bb75..30d7eced 100644 --- a/Minecraft.World/RegionHillsLayer.h +++ b/Minecraft.World/RegionHillsLayer.h @@ -5,7 +5,7 @@ class RegionHillsLayer : public Layer { public: - RegionHillsLayer(int64_t seed, shared_ptr<Layer> parent); + RegionHillsLayer(__int64 seed, shared_ptr<Layer> parent); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/RespawnPacket.cpp b/Minecraft.World/RespawnPacket.cpp index ecc0b7f0..5c04bbeb 100644 --- a/Minecraft.World/RespawnPacket.cpp +++ b/Minecraft.World/RespawnPacket.cpp @@ -5,7 +5,7 @@ #include "RespawnPacket.h" #include "LevelType.h" -RespawnPacket::RespawnPacket() +RespawnPacket::RespawnPacket() { this->dimension = 0; this->difficulty = 1; @@ -19,7 +19,7 @@ RespawnPacket::RespawnPacket() m_hellScale = HELL_LEVEL_MAX_SCALE; } -RespawnPacket::RespawnPacket(char dimension, int64_t mapSeed, int mapHeight, GameType *playerGameType, char difficulty, LevelType *pLevelType, bool newSeaLevel, int newEntityId, int xzSize, int hellScale) +RespawnPacket::RespawnPacket(char dimension, __int64 mapSeed, int mapHeight, GameType *playerGameType, char difficulty, LevelType *pLevelType, bool newSeaLevel, int newEntityId, int xzSize, int hellScale) { this->dimension = dimension; this->mapSeed = mapSeed; @@ -35,7 +35,7 @@ RespawnPacket::RespawnPacket(char dimension, int64_t mapSeed, int mapHeight, Gam } -void RespawnPacket::handle(PacketListener *listener) +void RespawnPacket::handle(PacketListener *listener) { listener->handleRespawn(shared_from_this()); } @@ -47,7 +47,7 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException mapHeight = dis->readShort(); wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); - if (m_pLevelType == NULL) + if (m_pLevelType == NULL) { m_pLevelType = LevelType::lvl_normal; } @@ -63,16 +63,16 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException } -void RespawnPacket::write(DataOutputStream *dos) //throws IOException +void RespawnPacket::write(DataOutputStream *dos) //throws IOException { dos->writeByte(dimension); dos->writeByte(playerGameType->getId()); dos->writeShort(mapHeight); - if (m_pLevelType == NULL) + if (m_pLevelType == NULL) { writeUtf(L"", dos); - } - else + } + else { writeUtf(m_pLevelType->getGeneratorName(), dos); } @@ -86,10 +86,10 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException #endif } -int RespawnPacket::getEstimatedSize() +int RespawnPacket::getEstimatedSize() { int length=0; - if (m_pLevelType != NULL) + if (m_pLevelType != NULL) { length = (int)m_pLevelType->getGeneratorName().length(); } diff --git a/Minecraft.World/RespawnPacket.h b/Minecraft.World/RespawnPacket.h index 3caf1ee3..dc341ea1 100644 --- a/Minecraft.World/RespawnPacket.h +++ b/Minecraft.World/RespawnPacket.h @@ -11,7 +11,7 @@ class RespawnPacket : public Packet, public enable_shared_from_this<RespawnPacke public: char dimension; char difficulty; - int64_t mapSeed; + __int64 mapSeed; int mapHeight; GameType *playerGameType; bool m_newSeaLevel; // 4J added @@ -21,7 +21,7 @@ public: int m_hellScale; // 4J Added RespawnPacket(); - RespawnPacket(char dimension, int64_t mapSeed, int mapHeight, GameType *playerGameType, char difficulty, LevelType *pLevelType, bool newSeaLevel, int newEntityId, int xzSize, int hellScale); + RespawnPacket(char dimension, __int64 mapSeed, int mapHeight, GameType *playerGameType, char difficulty, LevelType *pLevelType, bool newSeaLevel, int newEntityId, int xzSize, int hellScale); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); diff --git a/Minecraft.World/RiverInitLayer.cpp b/Minecraft.World/RiverInitLayer.cpp index 86110e13..e9497896 100644 --- a/Minecraft.World/RiverInitLayer.cpp +++ b/Minecraft.World/RiverInitLayer.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "net.minecraft.world.level.newbiome.layer.h" -RiverInitLayer::RiverInitLayer(int64_t seed, shared_ptr<Layer>parent) : Layer(seed) +RiverInitLayer::RiverInitLayer(__int64 seed, shared_ptr<Layer>parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/RiverInitLayer.h b/Minecraft.World/RiverInitLayer.h index bc8dca1b..6deb50e9 100644 --- a/Minecraft.World/RiverInitLayer.h +++ b/Minecraft.World/RiverInitLayer.h @@ -5,7 +5,7 @@ class RiverInitLayer : public Layer { public: - RiverInitLayer(int64_t seed, shared_ptr<Layer>parent); + RiverInitLayer(__int64 seed, shared_ptr<Layer>parent); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/RiverLayer.cpp b/Minecraft.World/RiverLayer.cpp index 14cf3142..8f805bab 100644 --- a/Minecraft.World/RiverLayer.cpp +++ b/Minecraft.World/RiverLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.level.newbiome.layer.h" -RiverLayer::RiverLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +RiverLayer::RiverLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/RiverLayer.h b/Minecraft.World/RiverLayer.h index a76d3fab..657ac07c 100644 --- a/Minecraft.World/RiverLayer.h +++ b/Minecraft.World/RiverLayer.h @@ -5,6 +5,6 @@ class RiverLayer : public Layer { public: - RiverLayer(int64_t seedMixup, shared_ptr<Layer>parent); + RiverLayer(__int64 seedMixup, shared_ptr<Layer>parent); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/RiverMixerLayer.cpp b/Minecraft.World/RiverMixerLayer.cpp index 4de49245..62dfdd6c 100644 --- a/Minecraft.World/RiverMixerLayer.cpp +++ b/Minecraft.World/RiverMixerLayer.cpp @@ -2,13 +2,13 @@ #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.level.newbiome.layer.h" -RiverMixerLayer::RiverMixerLayer(int64_t seed, shared_ptr<Layer>biomes, shared_ptr<Layer>rivers) : Layer(seed) +RiverMixerLayer::RiverMixerLayer(__int64 seed, shared_ptr<Layer>biomes, shared_ptr<Layer>rivers) : Layer(seed) { this->biomes = biomes; this->rivers = rivers; } -void RiverMixerLayer::init(int64_t seed) +void RiverMixerLayer::init(__int64 seed) { biomes->init(seed); rivers->init(seed); diff --git a/Minecraft.World/RiverMixerLayer.h b/Minecraft.World/RiverMixerLayer.h index 3a069c41..eec51610 100644 --- a/Minecraft.World/RiverMixerLayer.h +++ b/Minecraft.World/RiverMixerLayer.h @@ -9,8 +9,8 @@ private: shared_ptr<Layer>rivers; public: - RiverMixerLayer(int64_t seed, shared_ptr<Layer>biomes, shared_ptr<Layer>rivers); + RiverMixerLayer(__int64 seed, shared_ptr<Layer>biomes, shared_ptr<Layer>rivers); - virtual void init(int64_t seed); + virtual void init(__int64 seed); virtual intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/SetTimePacket.cpp b/Minecraft.World/SetTimePacket.cpp index 1f0701eb..2f707970 100644 --- a/Minecraft.World/SetTimePacket.cpp +++ b/Minecraft.World/SetTimePacket.cpp @@ -6,12 +6,12 @@ -SetTimePacket::SetTimePacket() +SetTimePacket::SetTimePacket() { time = 0; } -SetTimePacket::SetTimePacket(int64_t time) +SetTimePacket::SetTimePacket(__int64 time) { this->time = time; } @@ -21,7 +21,7 @@ void SetTimePacket::read(DataInputStream *dis) //throws IOException time = dis->readLong(); } -void SetTimePacket::write(DataOutputStream *dos) //throws IOException +void SetTimePacket::write(DataOutputStream *dos) //throws IOException { dos->writeLong(time); } diff --git a/Minecraft.World/SetTimePacket.h b/Minecraft.World/SetTimePacket.h index b7d3e645..5b658a0b 100644 --- a/Minecraft.World/SetTimePacket.h +++ b/Minecraft.World/SetTimePacket.h @@ -6,10 +6,10 @@ using namespace std; class SetTimePacket : public Packet, public enable_shared_from_this<SetTimePacket> { public: - int64_t time; + __int64 time; SetTimePacket(); - SetTimePacket(int64_t time); + SetTimePacket(__int64 time); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/ShoreLayer.cpp b/Minecraft.World/ShoreLayer.cpp index 7ae52557..297571f5 100644 --- a/Minecraft.World/ShoreLayer.cpp +++ b/Minecraft.World/ShoreLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "net.minecraft.world.level.biome.h" -ShoreLayer::ShoreLayer(int64_t seed, shared_ptr<Layer> parent) : Layer(seed) +ShoreLayer::ShoreLayer(__int64 seed, shared_ptr<Layer> parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/ShoreLayer.h b/Minecraft.World/ShoreLayer.h index a7053004..96aea152 100644 --- a/Minecraft.World/ShoreLayer.h +++ b/Minecraft.World/ShoreLayer.h @@ -4,6 +4,6 @@ class ShoreLayer : public Layer { public: - ShoreLayer(int64_t seed, shared_ptr<Layer> parent); + ShoreLayer(__int64 seed, shared_ptr<Layer> parent); virtual intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/SkyIslandDimension.cpp b/Minecraft.World/SkyIslandDimension.cpp index aa68bd5e..0746c92c 100644 --- a/Minecraft.World/SkyIslandDimension.cpp +++ b/Minecraft.World/SkyIslandDimension.cpp @@ -16,7 +16,7 @@ ChunkSource *SkyIslandDimension::createRandomLevelSource() const return new SkyIslandRandomLevelSource(level, level->getSeed()); } -float SkyIslandDimension::getTimeOfDay(int64_t time, float a) const +float SkyIslandDimension::getTimeOfDay(__int64 time, float a) const { return 0.0f; } diff --git a/Minecraft.World/SmoothLayer.cpp b/Minecraft.World/SmoothLayer.cpp index e94ae36d..a5545cc5 100644 --- a/Minecraft.World/SmoothLayer.cpp +++ b/Minecraft.World/SmoothLayer.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "net.minecraft.world.level.newbiome.layer.h" -SmoothLayer::SmoothLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +SmoothLayer::SmoothLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/SmoothLayer.h b/Minecraft.World/SmoothLayer.h index 14e3d152..eec3f19e 100644 --- a/Minecraft.World/SmoothLayer.h +++ b/Minecraft.World/SmoothLayer.h @@ -5,7 +5,7 @@ class SmoothLayer : public Layer { public: - SmoothLayer(int64_t seedMixup, shared_ptr<Layer>parent); + SmoothLayer(__int64 seedMixup, shared_ptr<Layer>parent); virtual intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/SmoothZoomLayer.cpp b/Minecraft.World/SmoothZoomLayer.cpp index 2df34a3b..3e1c55a1 100644 --- a/Minecraft.World/SmoothZoomLayer.cpp +++ b/Minecraft.World/SmoothZoomLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "System.h" -SmoothZoomLayer::SmoothZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +SmoothZoomLayer::SmoothZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } @@ -50,7 +50,7 @@ intArray SmoothZoomLayer::getArea(int xo, int yo, int w, int h) return result; } -shared_ptr<Layer>SmoothZoomLayer::zoom(int64_t seed, shared_ptr<Layer>sup, int count) +shared_ptr<Layer>SmoothZoomLayer::zoom(__int64 seed, shared_ptr<Layer>sup, int count) { shared_ptr<Layer>result = sup; for (int i = 0; i < count; i++) diff --git a/Minecraft.World/SmoothZoomLayer.h b/Minecraft.World/SmoothZoomLayer.h index 90cc292e..b2ac4e78 100644 --- a/Minecraft.World/SmoothZoomLayer.h +++ b/Minecraft.World/SmoothZoomLayer.h @@ -5,8 +5,8 @@ class SmoothZoomLayer : public Layer { public: - SmoothZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent); + SmoothZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent); virtual intArray getArea(int xo, int yo, int w, int h); - static shared_ptr<Layer>zoom(int64_t seed, shared_ptr<Layer>sup, int count); + static shared_ptr<Layer>zoom(__int64 seed, shared_ptr<Layer>sup, int count); };
\ No newline at end of file diff --git a/Minecraft.World/Socket.h b/Minecraft.World/Socket.h index c4ec9fc8..0019f984 100644 --- a/Minecraft.World/Socket.h +++ b/Minecraft.World/Socket.h @@ -36,7 +36,7 @@ private: virtual int read(byteArray b); virtual int read(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual int64_t skip(int64_t n) { return n; } // 4J Stu - Not implemented + virtual __int64 skip(__int64 n) { return n; } // 4J Stu - Not implemented virtual void flush() {} }; @@ -68,7 +68,7 @@ private: virtual int read(byteArray b); virtual int read(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual int64_t skip(int64_t n) { return n; } // 4J Stu - Not implemented + virtual __int64 skip(__int64 n) { return n; } // 4J Stu - Not implemented virtual void flush() {} }; class SocketOutputStreamNetwork : public SocketOutputStream @@ -86,13 +86,13 @@ private: virtual void close(); virtual void flush() {} }; - + bool m_hostServerConnection; // true if this is the connection between the host player and server bool m_hostLocal; // true if this player on the same machine as the host int m_end; // 0 for client side or 1 for host side // For local connections between the host player and the server - static CRITICAL_SECTION s_hostQueueLock[2]; + static CRITICAL_SECTION s_hostQueueLock[2]; static std::queue<byte> s_hostQueue[2]; static SocketOutputStreamLocal *s_hostOutStream[2]; static SocketInputStreamLocal *s_hostInStream[2]; @@ -108,7 +108,7 @@ private: static ServerConnection *s_serverConnection; BYTE networkPlayerSmallId; -public: +public: C4JThread::Event* m_socketClosedEvent; INetworkPlayer *getPlayer(); diff --git a/Minecraft.World/SparseDataStorage.cpp b/Minecraft.World/SparseDataStorage.cpp index 780c9819..6db131e7 100644 --- a/Minecraft.World/SparseDataStorage.cpp +++ b/Minecraft.World/SparseDataStorage.cpp @@ -40,7 +40,7 @@ SparseDataStorage::SparseDataStorage() // Data and count packs together the pointer to our data and the count of planes allocated - 127 planes allocated in this case #pragma warning ( disable : 4826 ) - dataAndCount = 0x007F000000000000L | (( (int64_t) planeIndices ) & 0x0000ffffffffffffL); + dataAndCount = 0x007F000000000000L | (( (__int64) planeIndices ) & 0x0000ffffffffffffL); #pragma warning ( default : 4826 ) #ifdef DATA_COMPRESSION_STATS count = 128; @@ -59,7 +59,7 @@ SparseDataStorage::SparseDataStorage(bool isUpper) // Data and count packs together the pointer to our data and the count of planes allocated - 127 planes allocated in this case #pragma warning ( disable : 4826 ) - dataAndCount = 0x0000000000000000L | (( (int64_t) planeIndices ) & 0x0000ffffffffffffL); + dataAndCount = 0x0000000000000000L | (( (__int64) planeIndices ) & 0x0000ffffffffffffL); #pragma warning ( default : 4826 ) #ifdef DATA_COMPRESSION_STATS count = 128; @@ -70,7 +70,7 @@ SparseDataStorage::~SparseDataStorage() { unsigned char *indicesAndData = (unsigned char *)(dataAndCount & 0x0000ffffffffffff); // Determine correct means to free this data - could have been allocated either with XPhysicalAlloc or malloc - + #ifdef _XBOX if( (unsigned int)indicesAndData >= MM_PHYSICAL_4KB_BASE ) { @@ -87,7 +87,7 @@ SparseDataStorage::~SparseDataStorage() SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom) { // Extra details of source storage - int64_t sourceDataAndCount = copyFrom->dataAndCount; + __int64 sourceDataAndCount = copyFrom->dataAndCount; unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff); int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff; @@ -97,7 +97,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom) // AP - I've moved this to be before the memcpy because of a very strange bug on vita. Sometimes dataAndCount wasn't valid in time when ::get was called. // This should never happen and this isn't a proper solution but fixes it for now. #pragma warning ( disable : 4826 ) - dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((int64_t) destIndicesAndData ) & 0x0000ffffffffffffL ); + dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((__int64) destIndicesAndData ) & 0x0000ffffffffffffL ); #pragma warning ( default : 4826 ) XMemCpy( destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128 ); @@ -126,7 +126,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) for( int y = 0; y < 128; y++ ) { bool all0 = true; - + for( int xz = 0; xz < 256; xz++ ) // 256 in loop as 16 x 16 separate bytes need checked { int pos = ( xz << 7 ) | y; @@ -176,9 +176,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) planeIndices) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48; + newDataAndCount |= ((__int64)allocatedPlaneCount) << 48; updateDataAndCount( newDataAndCount ); } @@ -230,7 +230,7 @@ int SparseDataStorage::get(int x, int y, int z) { unsigned char *planeIndices, *data; getPlaneIndicesAndData(&planeIndices, &data); - + if( planeIndices[y] == ALL_0_INDEX ) { return 0; @@ -370,7 +370,7 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0 } } ptrdiff_t count = pucOut - &dataInOut.data[offset]; - + return (int)count; } @@ -380,7 +380,7 @@ void SparseDataStorage::addNewPlane(int y) do { // Get last packed data pointer & count - int64_t lastDataAndCount = dataAndCount; + __int64 lastDataAndCount = dataAndCount; // Unpack count & data pointer int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff); @@ -388,9 +388,9 @@ void SparseDataStorage::addNewPlane(int y) // Find out what to prefill the newly allocated line with unsigned char planeIndex = lastDataPointer[y]; - + if( planeIndex < ALL_0_INDEX ) return; // Something has already allocated this line - we're done - + int linesUsed = lastLinesUsed + 1; // Allocate new memory storage, copy over anything from old storage, and initialise remainder @@ -401,14 +401,14 @@ void SparseDataStorage::addNewPlane(int y) // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)linesUsed) << 48; + newDataAndCount |= ((__int64)linesUsed) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); - + __int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + if( lastDataAndCount2 == lastDataAndCount ) { success = true; @@ -473,20 +473,20 @@ void SparseDataStorage::tick() } // Update storage with a new values for dataAndCount, repeating as necessary if other simultaneous writes happen. -void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) +void SparseDataStorage::updateDataAndCount(__int64 newDataAndCount) { // Now actually assign this data to the storage. Just repeat until successful, there isn't any useful really that we can merge the results of this // with any other simultaneous writes that might be happening. bool success = false; do { - int64_t lastDataAndCount = dataAndCount; + __int64 lastDataAndCount = dataAndCount; unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); - + __int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + if( lastDataAndCount2 == lastDataAndCount ) { success = true; @@ -508,7 +508,7 @@ int SparseDataStorage::compress() unsigned char _planeIndices[128]; bool needsCompressed = false; - int64_t lastDataAndCount = dataAndCount; + __int64 lastDataAndCount = dataAndCount; unsigned char *planeIndices = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); unsigned char *data = planeIndices + 128; @@ -558,13 +558,13 @@ int SparseDataStorage::compress() // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) newIndicesAndData) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)planesToAlloc) << 48; + newDataAndCount |= ((__int64)planesToAlloc) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + __int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); if( lastDataAndCount2 != lastDataAndCount ) { @@ -576,7 +576,7 @@ int SparseDataStorage::compress() { // Success queueForDelete( planeIndices ); -// printf("Successfully compressed to %d planes, to delete 0x%x\n", planesToAlloc, planeIndices); +// printf("Successfully compressed to %d planes, to delete 0x%x\n", planesToAlloc, planeIndices); #ifdef DATA_COMPRESSION_STATS count = planesToAlloc; #endif @@ -617,9 +617,9 @@ void SparseDataStorage::read(DataInputStream *dis) dis->readFully(wrapper); #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)count) << 48; + newDataAndCount |= ((__int64)count) << 48; updateDataAndCount(newDataAndCount); } diff --git a/Minecraft.World/SparseDataStorage.h b/Minecraft.World/SparseDataStorage.h index 16289cda..93d5c424 100644 --- a/Minecraft.World/SparseDataStorage.h +++ b/Minecraft.World/SparseDataStorage.h @@ -18,9 +18,9 @@ // To meet these requirements, this class is now implemented using a lock-free system, implemented using a read-copy-update (RCU) type algorithm. Some details... -// (1) The storage details for the class are now packed into a single int64_t, which contains both a pointer to the data that is required and a count of how many planes worth +// (1) The storage details for the class are now packed into a single __int64, which contains both a pointer to the data that is required and a count of how many planes worth // of storage are allocated. This allows the full storage to be updated atomically using compare and exchange operations (implemented with InterlockedCompareExchangeRelease64). -// (2) The data pointer referenced in this int64_t points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and +// (2) The data pointer referenced in this __int64 points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and // the rest of the data is variable in size to accomodate however many planes are required to be stored // (3) The RCU bit of the algorithm means that any read operations don't need to do any checks or locks at all. When the data needs to be updated, a copy of it is made and updated, // then an attempt is made to swap the new data in - if this succeeds then the old data pointer is deleted later at some point where we know nothing will be reading from it anymore. @@ -36,7 +36,7 @@ class SparseDataStorage friend class TileCompressData_SPU; private: // unsigned char planeIndices[128]; - int64_t dataAndCount; // Contains packed-together data pointer (lower 48-bits), and count of lines used (upper 16-bits) + __int64 dataAndCount; // Contains packed-together data pointer (lower 48-bits), and count of lines used (upper 16-bits) // unsigned char *data; // unsigned int allocatedPlaneCount; @@ -64,7 +64,7 @@ public: void addNewPlane(int y); void getPlaneIndicesAndData(unsigned char **planeIndices, unsigned char **data); - void updateDataAndCount(int64_t newDataAndCount); + void updateDataAndCount(__int64 newDataAndCount); int compress(); bool isCompressed(); diff --git a/Minecraft.World/SparseLightStorage.cpp b/Minecraft.World/SparseLightStorage.cpp index a0ba41b1..f9a2f0cb 100644 --- a/Minecraft.World/SparseLightStorage.cpp +++ b/Minecraft.World/SparseLightStorage.cpp @@ -40,7 +40,7 @@ SparseLightStorage::SparseLightStorage(bool sky) // Data and count packs together the pointer to our data and the count of planes allocated - 127 planes allocated in this case #pragma warning ( disable : 4826 ) - dataAndCount = 0x007F000000000000L | (( (int64_t) planeIndices ) & 0x0000ffffffffffffL); + dataAndCount = 0x007F000000000000L | (( (__int64) planeIndices ) & 0x0000ffffffffffffL); #pragma warning ( default : 4826 ) #ifdef LIGHT_COMPRESSION_STATS count = 127; @@ -59,7 +59,7 @@ SparseLightStorage::SparseLightStorage(bool sky, bool isUpper) // Data and count packs together the pointer to our data and the count of planes allocated - 0 planes allocated in this case #pragma warning ( disable : 4826 ) - dataAndCount = 0x0000000000000000L | (( (int64_t) planeIndices ) & 0x0000ffffffffffffL); + dataAndCount = 0x0000000000000000L | (( (__int64) planeIndices ) & 0x0000ffffffffffffL); #pragma warning ( default : 4826 ) #ifdef LIGHT_COMPRESSION_STATS count = 0; @@ -70,7 +70,7 @@ SparseLightStorage::~SparseLightStorage() { unsigned char *indicesAndData = (unsigned char *)(dataAndCount & 0x0000ffffffffffff); // Determine correct means to free this data - could have been allocated either with XPhysicalAlloc or malloc - + #ifdef _XBOX if( (unsigned int)indicesAndData >= MM_PHYSICAL_4KB_BASE ) { @@ -87,7 +87,7 @@ SparseLightStorage::~SparseLightStorage() SparseLightStorage::SparseLightStorage(SparseLightStorage *copyFrom) { // Extra details of source storage - int64_t sourceDataAndCount = copyFrom->dataAndCount; + __int64 sourceDataAndCount = copyFrom->dataAndCount; unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff); int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff; @@ -97,7 +97,7 @@ SparseLightStorage::SparseLightStorage(SparseLightStorage *copyFrom) // AP - I've moved this to be before the memcpy because of a very strange bug on vita. Sometimes dataAndCount wasn't valid in time when ::get was called. // This should never happen and this isn't a proper solution but fixes it for now. #pragma warning ( disable : 4826 ) - dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((int64_t) destIndicesAndData ) & 0x0000ffffffffffffL ); + dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((__int64) destIndicesAndData ) & 0x0000ffffffffffffL ); #pragma warning ( default : 4826 ) XMemCpy( destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128 ); @@ -125,7 +125,7 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) { bool all0 = true; bool all15 = true; - + for( int xz = 0; xz < 256; xz++ ) // 256 in loop as 16 x 16 separate bytes need checked { int pos = ( xz << 7 ) | y; @@ -180,9 +180,9 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) planeIndices) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48; + newDataAndCount |= ((__int64)allocatedPlaneCount) << 48; updateDataAndCount( newDataAndCount ); } @@ -245,7 +245,7 @@ int SparseLightStorage::get(int x, int y, int z) { unsigned char *planeIndices, *data; getPlaneIndicesAndData(&planeIndices, &data); - + if( planeIndices[y] == ALL_0_INDEX ) { return 0; @@ -312,7 +312,7 @@ void SparseLightStorage::setAllBright() } // Data and count packs together the pointer to our data and the count of planes allocated, which is currently zero #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ( (int64_t) planeIndices ) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ( (__int64) planeIndices ) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) updateDataAndCount( newDataAndCount ); @@ -375,7 +375,7 @@ int SparseLightStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z } } ptrdiff_t count = pucOut - &dataInOut.data[offset]; - + return (int)count; } @@ -385,7 +385,7 @@ void SparseLightStorage::addNewPlane(int y) do { // Get last packed data pointer & count - int64_t lastDataAndCount = dataAndCount; + __int64 lastDataAndCount = dataAndCount; // Unpack count & data pointer int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff); @@ -407,14 +407,14 @@ void SparseLightStorage::addNewPlane(int y) // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)linesUsed) << 48; + newDataAndCount |= ((__int64)linesUsed) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); - + __int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + if( lastDataAndCount2 == lastDataAndCount ) { success = true; @@ -479,20 +479,20 @@ void SparseLightStorage::tick() } // Update storage with a new values for dataAndCount, repeating as necessary if other simultaneous writes happen. -void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) +void SparseLightStorage::updateDataAndCount(__int64 newDataAndCount) { // Now actually assign this data to the storage. Just repeat until successful, there isn't any useful really that we can merge the results of this // with any other simultaneous writes that might be happening. bool success = false; do { - int64_t lastDataAndCount = dataAndCount; + __int64 lastDataAndCount = dataAndCount; unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); - + __int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + if( lastDataAndCount2 == lastDataAndCount ) { success = true; @@ -514,7 +514,7 @@ int SparseLightStorage::compress() unsigned char _planeIndices[128]; bool needsCompressed = false; - int64_t lastDataAndCount = dataAndCount; + __int64 lastDataAndCount = dataAndCount; unsigned char *planeIndices = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); unsigned char *data = planeIndices + 128; @@ -575,13 +575,13 @@ int SparseLightStorage::compress() // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) newIndicesAndData) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)planesToAlloc) << 48; + newDataAndCount |= ((__int64)planesToAlloc) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + __int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); if( lastDataAndCount2 != lastDataAndCount ) { @@ -593,7 +593,7 @@ int SparseLightStorage::compress() { // Success queueForDelete( planeIndices ); -// printf("Successfully compressed to %d planes, to delete 0x%x\n", planesToAlloc, planeIndices); +// printf("Successfully compressed to %d planes, to delete 0x%x\n", planesToAlloc, planeIndices); #ifdef LIGHT_COMPRESSION_STATS count = planesToAlloc; #endif @@ -634,9 +634,9 @@ void SparseLightStorage::read(DataInputStream *dis) dis->readFully(wrapper); #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; + __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((int64_t)count) << 48; + newDataAndCount |= ((__int64)count) << 48; updateDataAndCount( newDataAndCount ); } diff --git a/Minecraft.World/SparseLightStorage.h b/Minecraft.World/SparseLightStorage.h index c4cfbd04..d05d7645 100644 --- a/Minecraft.World/SparseLightStorage.h +++ b/Minecraft.World/SparseLightStorage.h @@ -20,9 +20,9 @@ // To meet these requirements, this class is now implemented using a lock-free system, implemented using a read-copy-update (RCU) type algorithm. Some details... -// (1) The storage details for the class are now packed into a single int64_t, which contains both a pointer to the data that is required and a count of how many planes worth +// (1) The storage details for the class are now packed into a single __int64, which contains both a pointer to the data that is required and a count of how many planes worth // of storage are allocated. This allows the full storage to be updated atomically using compare and exchange operations (implemented with InterlockedCompareExchangeRelease64). -// (2) The data pointer referenced in this int64_t points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and +// (2) The data pointer referenced in this __int64 points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and // the rest of the data is variable in size to accomodate however many planes are required to be stored // (3) The RCU bit of the algorithm means that any read operations don't need to do any checks or locks at all. When the data needs to be updated, a copy of it is made and updated, // then an attempt is made to swap the new data in - if this succeeds then the old data pointer is deleted later at some point where we know nothing will be reading from it anymore. @@ -38,7 +38,7 @@ class SparseLightStorage friend class TileCompressData_SPU; private: // unsigned char planeIndices[128]; - int64_t dataAndCount; // Contains packed-together data pointer (lower 48-bits), and count of lines used (upper 16-bits) + __int64 dataAndCount; // Contains packed-together data pointer (lower 48-bits), and count of lines used (upper 16-bits) // unsigned char *data; // unsigned int allocatedPlaneCount; @@ -66,7 +66,7 @@ public: void addNewPlane(int y); void getPlaneIndicesAndData(unsigned char **planeIndices, unsigned char **data); - void updateDataAndCount(int64_t newDataAndCount); + void updateDataAndCount(__int64 newDataAndCount); int compress(); bool isCompressed(); diff --git a/Minecraft.World/StructureFeature.cpp b/Minecraft.World/StructureFeature.cpp index 9a204d00..5e8489f0 100644 --- a/Minecraft.World/StructureFeature.cpp +++ b/Minecraft.World/StructureFeature.cpp @@ -92,16 +92,16 @@ bool StructureFeature::isIntersection(int cellX, int cellZ) /////////////////////////////////////////// // 4J-PB - Below functions added from 1.2.3 /////////////////////////////////////////// -bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ) +bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ) { - //for (StructureStart structureStart : cachedStructures.values()) + //for (StructureStart structureStart : cachedStructures.values()) for(AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); ++it) { StructureStart *pStructureStart = it->second; - if (pStructureStart->isValid()) + if (pStructureStart->isValid()) { - if (pStructureStart->getBoundingBox()->intersects(cellX, cellZ, cellX, cellZ)) + if (pStructureStart->getBoundingBox()->intersects(cellX, cellZ, cellX, cellZ)) { /* Iterator<StructurePiece> it = structureStart.getPieces().iterator(); @@ -127,7 +127,7 @@ bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ) return false; } -TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, int cellY, int cellZ) +TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, int cellY, int cellZ) { // this is a hack that will "force" the feature to generate positions @@ -135,10 +135,10 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i this->level = level; random->setSeed(level->getSeed()); - int64_t xScale = random->nextLong(); - int64_t zScale = random->nextLong(); - int64_t xx = (cellX >> 4) * xScale; - int64_t zz = (cellZ >> 4) * zScale; + __int64 xScale = random->nextLong(); + __int64 zScale = random->nextLong(); + __int64 xx = (cellX >> 4) * xScale; + __int64 zz = (cellZ >> 4) * zScale; random->setSeed(xx ^ zz ^ level->getSeed()); addFeature(level, cellX >> 4, cellZ >> 4, 0, 0, byteArray()); @@ -150,7 +150,7 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i { StructureStart *pStructureStart = it->second; - if (pStructureStart->isValid()) + if (pStructureStart->isValid()) { //StructurePiece *pStructurePiece = pStructureStart->getPieces().get(0); @@ -162,21 +162,21 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i int dz = locatorPosition->z - cellZ; double dist = dx + dx * dy * dy + dz * dz; - if (dist < minDistance) + if (dist < minDistance) { minDistance = dist; selected = locatorPosition; } } } - if (selected != NULL) + if (selected != NULL) { return selected; - } - else + } + else { vector<TilePos> *guesstimatedFeaturePositions = getGuesstimatedFeaturePositions(); - if (guesstimatedFeaturePositions != NULL) + if (guesstimatedFeaturePositions != NULL) { TilePos *pSelectedPos = new TilePos(0,0,0); @@ -187,7 +187,7 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i int dz = (*it).z - cellZ; double dist = dx + dx * dy * dy + dz * dz; - if (dist < minDistance) + if (dist < minDistance) { minDistance = dist; pSelectedPos->x = (*it).x; @@ -202,7 +202,7 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i return NULL; } -vector<TilePos> *StructureFeature::getGuesstimatedFeaturePositions() +vector<TilePos> *StructureFeature::getGuesstimatedFeaturePositions() { return NULL; } diff --git a/Minecraft.World/StructureFeature.h b/Minecraft.World/StructureFeature.h index 22f4cd66..642e6aad 100644 --- a/Minecraft.World/StructureFeature.h +++ b/Minecraft.World/StructureFeature.h @@ -16,7 +16,7 @@ public: }; protected: - unordered_map<int64_t, StructureStart *> cachedStructures; + unordered_map<__int64, StructureStart *> cachedStructures; public: ~StructureFeature(); @@ -29,12 +29,12 @@ public: bool isInsideFeature(int cellX, int cellY, int cellZ); TilePos *getNearestGeneratedFeature(Level *level, int cellX, int cellY, int cellZ); protected: - vector<TilePos> *getGuesstimatedFeaturePositions(); + vector<TilePos> *getGuesstimatedFeaturePositions(); /** * Returns true if the given chunk coordinates should hold a structure * source. - * + * * @param x * chunk x * @param z @@ -47,7 +47,7 @@ protected: /** * Creates a new instance of a structure source at the given chunk * coordinates. - * + * * @param x * chunk x * @param z diff --git a/Minecraft.World/SwampRiversLayer.cpp b/Minecraft.World/SwampRiversLayer.cpp index cd22cae8..68cef8a8 100644 --- a/Minecraft.World/SwampRiversLayer.cpp +++ b/Minecraft.World/SwampRiversLayer.cpp @@ -3,7 +3,7 @@ #include "IntCache.h" #include "SwampRiversLayer.h" -SwampRiversLayer::SwampRiversLayer(int64_t seed, shared_ptr<Layer> parent) : Layer(seed) +SwampRiversLayer::SwampRiversLayer(__int64 seed, shared_ptr<Layer> parent) : Layer(seed) { this->parent = parent; } diff --git a/Minecraft.World/SwampRiversLayer.h b/Minecraft.World/SwampRiversLayer.h index 97bab0f4..f724ad82 100644 --- a/Minecraft.World/SwampRiversLayer.h +++ b/Minecraft.World/SwampRiversLayer.h @@ -5,7 +5,7 @@ class SwampRiversLayer : public Layer { public: - SwampRiversLayer(int64_t seed, shared_ptr<Layer> parent); + SwampRiversLayer(__int64 seed, shared_ptr<Layer> parent); intArray getArea(int xo, int yo, int w, int h); };
\ No newline at end of file diff --git a/Minecraft.World/System.h b/Minecraft.World/System.h index 1d48b408..06e265cc 100644 --- a/Minecraft.World/System.h +++ b/Minecraft.World/System.h @@ -20,16 +20,16 @@ public: ArrayCopyFunctionDeclaration(Biome *) ArrayCopyFunctionDeclaration(int) - static int64_t nanoTime(); - static int64_t currentTimeMillis(); - static int64_t currentRealTimeMillis(); // 4J Added to get real-world time for timestamps in saves + static __int64 nanoTime(); + static __int64 currentTimeMillis(); + static __int64 currentRealTimeMillis(); // 4J Added to get real-world time for timestamps in saves static void ReverseUSHORT(unsigned short *pusVal); static void ReverseSHORT(short *psVal); static void ReverseULONG(unsigned long *pulVal); static void ReverseULONG(unsigned int *pulVal); static void ReverseINT(int *piVal); - static void ReverseULONGLONG(int64_t *pullVal); + static void ReverseULONGLONG(__int64 *pullVal); static void ReverseWCHARA(WCHAR *pwch,int iLen); }; diff --git a/Minecraft.World/TheEndDimension.cpp b/Minecraft.World/TheEndDimension.cpp index 031d6de4..ccc8641b 100644 --- a/Minecraft.World/TheEndDimension.cpp +++ b/Minecraft.World/TheEndDimension.cpp @@ -19,7 +19,7 @@ ChunkSource *TheEndDimension::createRandomLevelSource() const return new TheEndLevelRandomLevelSource(level, level->getSeed()); } -float TheEndDimension::getTimeOfDay(int64_t time, float a) const +float TheEndDimension::getTimeOfDay(__int64 time, float a) const { return 0.0f; } diff --git a/Minecraft.World/TheEndDimension.h b/Minecraft.World/TheEndDimension.h index 268be6f6..95bd6980 100644 --- a/Minecraft.World/TheEndDimension.h +++ b/Minecraft.World/TheEndDimension.h @@ -6,7 +6,7 @@ class TheEndDimension : public Dimension public: virtual void init(); virtual ChunkSource *createRandomLevelSource() const; - virtual float getTimeOfDay(int64_t time, float a) const; + virtual float getTimeOfDay(__int64 time, float a) const; virtual float *getSunriseColor(float td, float a); virtual Vec3 *getFogColor(float td, float a) const; virtual bool hasGround(); diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/TheEndLevelRandomLevelSource.cpp index 755f0d2f..46f3dbab 100644 --- a/Minecraft.World/TheEndLevelRandomLevelSource.cpp +++ b/Minecraft.World/TheEndLevelRandomLevelSource.cpp @@ -9,7 +9,7 @@ #include "net.minecraft.world.level.storage.h" #include "TheEndLevelRandomLevelSource.h" -TheEndLevelRandomLevelSource::TheEndLevelRandomLevelSource(Level *level, int64_t seed) +TheEndLevelRandomLevelSource::TheEndLevelRandomLevelSource(Level *level, __int64 seed) { m_XZSize = END_LEVEL_MIN_WIDTH; @@ -370,17 +370,17 @@ void TheEndLevelRandomLevelSource::postProcess(ChunkSource *parent, int xt, int // 4J - added. The original java didn't do any setting of the random seed here, and passes the level random to the biome decorator. // We'll be running our postProcess in parallel with getChunk etc. so we need to use a separate random - have used the same initialisation code as - // used in RandomLevelSource::postProcess to make sure this random value is consistent for each world generation. + // used in RandomLevelSource::postProcess to make sure this random value is consistent for each world generation. pprandom->setSeed(level->getSeed()); - int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; - int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; + __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); Biome *biome = level->getBiome(xo + 16, zo + 16); biome->decorate(level, pprandom, xo, zo); // 4J - passing pprandom rather than level->random here to make this consistent with our parallel world generation HeavyTile::instaFall = false; - + app.processSchematics(parent->getChunk(xt,zt)); } @@ -418,4 +418,4 @@ TilePos *TheEndLevelRandomLevelSource::findNearestMapFeature(Level *level, const { return NULL; } - + diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.h b/Minecraft.World/TheEndLevelRandomLevelSource.h index 217918ee..2dc7f131 100644 --- a/Minecraft.World/TheEndLevelRandomLevelSource.h +++ b/Minecraft.World/TheEndLevelRandomLevelSource.h @@ -9,7 +9,7 @@ public: static const double SNOW_CUTOFF; static const double SNOW_SCALE; static const bool FLOATING_ISLANDS; - + static const int CHUNK_HEIGHT = 4; static const int CHUNK_WIDTH = 8; private: @@ -30,7 +30,7 @@ private: Level *level; public: - TheEndLevelRandomLevelSource(Level *level, int64_t seed); + TheEndLevelRandomLevelSource(Level *level, __int64 seed); ~TheEndLevelRandomLevelSource(); void prepareHeights(int xOffs, int zOffs, byteArray blocks, BiomeArray biomes); @@ -56,5 +56,5 @@ public: public: virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z); }; diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index 77a62c8d..e0ef8dd9 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -16,14 +16,14 @@ #include "net.minecraft.h" #include "Tile.h" -wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; +wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; const float Tile::INDESTRUCTIBLE_DESTROY_TIME = -1.0f; Tile::SoundType *Tile::SOUND_NORMAL = NULL; Tile::SoundType *Tile::SOUND_WOOD = NULL; Tile::SoundType *Tile::SOUND_GRAVEL = NULL; -Tile::SoundType *Tile::SOUND_GRASS = NULL; +Tile::SoundType *Tile::SOUND_GRASS = NULL; Tile::SoundType *Tile::SOUND_STONE = NULL; Tile::SoundType *Tile::SOUND_METAL = NULL; Tile::SoundType *Tile::SOUND_GLASS = NULL; @@ -185,7 +185,7 @@ Tile *Tile::enderChest = NULL; TripWireSourceTile *Tile::tripWireSource = NULL; Tile *Tile::tripWire = NULL; Tile *Tile::emeraldBlock = NULL; - + Tile *Tile::cocoa = NULL; Tile *Tile::skull = NULL; @@ -273,7 +273,7 @@ void Tile::staticCtor() Tile::sponge = (new Sponge(19)) ->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRASS)->setTextureName(L"sponge")->setDescriptionId(IDS_TILE_SPONGE)->setUseDescriptionId(IDS_DESC_SPONGE); Tile::glass = (new GlassTile(20, Material::glass, false)) ->setDestroyTime(0.3f)->setSoundType(Tile::SOUND_GLASS)->setTextureName(L"glass")->setDescriptionId(IDS_TILE_GLASS)->setUseDescriptionId(IDS_DESC_GLASS); Tile::dispenser = (new DispenserTile(23)) ->setDestroyTime(3.5f)->setSoundType(Tile::SOUND_STONE)->setTextureName(L"dispenser")->setDescriptionId(IDS_TILE_DISPENSER)->sendTileData()->setUseDescriptionId(IDS_DESC_DISPENSER); - + //Tile::wood = (new Tile(5, 4, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structwoodstuff, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_WOOD)->sendTileData()->setUseDescriptionId(IDS_DESC_WOODENPLANKS); Tile::wood = (new WoodTile(5)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structwoodstuff, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setTextureName(L"wood")->setDescriptionId(IDS_TILE_OAKWOOD_PLANKS)->sendTileData()->setUseDescriptionId(IDS_DESC_WOODENPLANKS); Tile::sandStone = (new SandStoneTile(24)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_sand)->setSoundType(Tile::SOUND_STONE)->setDestroyTime(0.8f)->sendTileData()->setTextureName(L"sandStone")->setDescriptionId(IDS_TILE_SANDSTONE)->setUseDescriptionId(IDS_DESC_SANDSTONE)->sendTileData(); @@ -281,7 +281,7 @@ void Tile::staticCtor() Tile::redBrick = (new Tile(45, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_brick)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setTextureName(L"brick")->setDescriptionId(IDS_TILE_BRICK)->setUseDescriptionId(IDS_DESC_BRICK); Tile::clay = (new ClayTile(82)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_clay)->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRAVEL)->setTextureName(L"clay")->setDescriptionId(IDS_TILE_CLAY)->setUseDescriptionId(IDS_DESC_CLAY_TILE); Tile::snow = (new SnowTile(80)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_snow)->setDestroyTime(0.2f)->setSoundType(Tile::SOUND_CLOTH)->setTextureName(L"snow")->setDescriptionId(IDS_TILE_SNOW)->setUseDescriptionId(IDS_DESC_SNOW); - + Tile::torch = (new TorchTile(50)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_torch, Item::eMaterial_wood)->setDestroyTime(0.0f)->setLightEmission(15 / 16.0f)->setSoundType(Tile::SOUND_WOOD)->setTextureName(L"torch")->setDescriptionId(IDS_TILE_TORCH)->sendTileData()->setUseDescriptionId(IDS_DESC_TORCH)->disableMipmap(); Tile::litPumpkin = (new PumpkinTile(91, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_torch, Item::eMaterial_pumpkin)->setDestroyTime(1.0f)->setSoundType(Tile::SOUND_WOOD)->setLightEmission(1.0f)->setTextureName(L"litpumpkin")->setDescriptionId(IDS_TILE_LIT_PUMPKIN)->sendTileData()->setUseDescriptionId(IDS_DESC_JACKOLANTERN); Tile::lightGem = (new LightGemTile(89, Material::glass)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_torch, Item::eMaterial_glowstone)->setDestroyTime(0.3f)->setSoundType(Tile::SOUND_GLASS)->setLightEmission(1.0f)->setTextureName(L"lightgem")->setDescriptionId(IDS_TILE_LIGHT_GEM)->setUseDescriptionId(IDS_DESC_GLOWSTONE); @@ -310,17 +310,17 @@ void Tile::staticCtor() // Tile::stoneSlab = (new StoneSlabTile(43, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_SLAB); // Tile::stoneSlabHalf = (new StoneSlabTile(44, false)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_HALFSLAB); - + Tile::tnt = (new TntTile(46)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setTextureName(L"tnt")->setDescriptionId(IDS_TILE_TNT)->setUseDescriptionId(IDS_DESC_TNT); Tile::bookshelf = (new BookshelfTile(47)) ->setDestroyTime(1.5f)->setSoundType(Tile::SOUND_WOOD)->setTextureName(L"bookshelf")->setDescriptionId(IDS_TILE_BOOKSHELF)->setUseDescriptionId(IDS_DESC_BOOKSHELF); Tile::mossStone = (new Tile(48, Material::stone)) ->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setTextureName(L"stoneMoss")->setDescriptionId(IDS_TILE_STONE_MOSS)->setUseDescriptionId(IDS_DESC_MOSS_STONE); // 4J - change of destroy time from 10.0f -> 50.0f for obsidian brought forward from 1.2.3 Tile::obsidian = (new ObsidianTile(49)) ->setDestroyTime(50.0f)->setExplodeable(2000)->setSoundType(Tile::SOUND_STONE)->setTextureName(L"obsidian")->setDescriptionId(IDS_TILE_OBSIDIAN)->setUseDescriptionId(IDS_DESC_OBSIDIAN); - + Tile::fire = (FireTile *) ((new FireTile(51)) ->setDestroyTime(0.0f)->setLightEmission(1.0f)->setSoundType(Tile::SOUND_WOOD))->setTextureName(L"fire")->setDescriptionId(IDS_TILE_FIRE)->setNotCollectStatistics()->setUseDescriptionId(-1); Tile::mobSpawner = (new MobSpawnerTile(52)) ->setDestroyTime(5.0f)->setSoundType(Tile::SOUND_METAL)->setTextureName(L"mobSpawner")->setDescriptionId(IDS_TILE_MOB_SPAWNER)->setNotCollectStatistics()->setUseDescriptionId(IDS_DESC_MOB_SPAWNER); - + Tile::chest = (ChestTile *)(new ChestTile(54)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_chest, Item::eMaterial_ender)->setDestroyTime(2.5f)->setSoundType(Tile::SOUND_WOOD)->setTextureName(L"chest")->setDescriptionId(IDS_TILE_CHEST)->sendTileData()->setUseDescriptionId(IDS_DESC_CHEST); Tile::redStoneDust = (RedStoneDustTile *)(new RedStoneDustTile(55)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_NORMAL)->setTextureName(L"redstoneDust")->setDescriptionId(IDS_TILE_REDSTONE_DUST)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONE_DUST); Tile::workBench = (new WorkbenchTile(58)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_device, Item::eMaterial_wood)->setDestroyTime(2.5f)->setSoundType(Tile::SOUND_WOOD)->setTextureName(L"workbench")->setDescriptionId(IDS_TILE_WORKBENCH)->setUseDescriptionId(IDS_DESC_CRAFTINGTABLE); @@ -409,7 +409,7 @@ void Tile::staticCtor() Tile::tripWireSource = (TripWireSourceTile *)( new TripWireSourceTile(131) ) ->setTextureName(L"tripWireSource")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE_SOURCE)->setUseDescriptionId(IDS_DESC_TRIPWIRE_SOURCE); Tile::tripWire = (new TripWireTile(132)) ->setTextureName(L"tripWire")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE)->setUseDescriptionId(IDS_DESC_TRIPWIRE); Tile::emeraldBlock = (new MetalTile(133)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_emerald)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setTextureName(L"blockEmerald")->setDescriptionId(IDS_TILE_EMERALDBLOCK)->setUseDescriptionId(IDS_DESC_EMERALDBLOCK); - + Tile::cocoa = (new CocoaTile(127)) ->setDestroyTime(0.2f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setTextureName(L"cocoa")->sendTileData()->setDescriptionId(IDS_TILE_COCOA)->setUseDescriptionId(IDS_DESC_COCOA); Tile::skull = (new SkullTile(144)) ->setDestroyTime(1.0f)->setSoundType(SOUND_STONE)->setTextureName(L"skull")->setDescriptionId(IDS_TILE_SKULL)->setUseDescriptionId(IDS_DESC_SKULL); @@ -658,7 +658,7 @@ void Tile::setShape(float x0, float y0, float z0, float x1, float y1, float z1) tls->yy1 = y1; tls->zz1 = z1; tls->tileId = this->id; - + //this->xx0 = x0; //this->yy0 = y0; //this->zz0 = z0; @@ -798,7 +798,7 @@ AABB *Tile::getTileAABB(Level *level, int x, int y, int z) return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); } -void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source) +void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source) { AABB *aabb = getAABB(level, x, y, z); if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); @@ -977,7 +977,7 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) bool Tile::containsX(Vec3 *v) { if( v == NULL) return false; - + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); @@ -1333,7 +1333,7 @@ void Tile::handleRain(Level *level, int x, int y, int z) { } - void Tile::levelTimeChanged(Level *level, int64_t delta, int64_t newTime) + void Tile::levelTimeChanged(Level *level, __int64 delta, __int64 newTime) { } @@ -1454,26 +1454,26 @@ Tile::SoundType::SoundType(eMATERIALSOUND_TYPE eMaterialSound, float volume, flo } float Tile::SoundType::getVolume() const -{ - return volume; +{ + return volume; } float Tile::SoundType::getPitch() const -{ - return pitch; +{ + return pitch; } //wstring getBreakSound() const { return breakSound; } //wstring getStepSound() const { return stepSound; } int Tile::SoundType::getBreakSound() const -{ - return iBreakSound; +{ + return iBreakSound; } int Tile::SoundType::getStepSound() const -{ - return iStepSound; +{ + return iStepSound; } int Tile::SoundType::getPlaceSound() const -{ - return iPlaceSound; +{ + return iPlaceSound; } diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index fb17f917..fa2f5786 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -56,13 +56,13 @@ protected: ThreadStorage(); }; static DWORD tlsIdxShape; -public: +public: // Each new thread that needs to use Vec3 pools will need to call one of the following 2 functions, to either create its own // local storage, or share the default storage already allocated by the main thread static void CreateNewThreadStorage(); static void ReleaseThreadStorage(); -public: +public: static const int TILE_NUM_COUNT = 4096; static const int TILE_NUM_MASK = 0xfff; // 4096 - 1 static const int TILE_NUM_SHIFT = 12; // 4096 is 12 bits @@ -87,7 +87,7 @@ public: float pitch; SoundType(eMATERIALSOUND_TYPE eMaterialSound, float volume, float pitch, int iBreakSound = -1, int iPlaceSound = -1); - + float getVolume() const; float getPitch() const; //wstring getBreakSound() const { return breakSound; } @@ -100,7 +100,7 @@ public: static SoundType *SOUND_NORMAL; static SoundType *SOUND_WOOD; static SoundType *SOUND_GRAVEL; - static SoundType *SOUND_GRASS; + static SoundType *SOUND_GRASS; static SoundType *SOUND_STONE; static SoundType *SOUND_METAL; static SoundType *SOUND_GLASS; @@ -287,7 +287,7 @@ public: static const int redstoneLight_Id = 123; static const int redstoneLight_lit_Id = 124; - + static const int woodSlab_Id = 125; static const int woodSlabHalf_Id = 126; static const int cocoa_Id = 127; @@ -456,7 +456,7 @@ public: static TripWireSourceTile *tripWireSource; static Tile *tripWire; static Tile *emeraldBlock; - + static Tile *cocoa; static Tile *skull; @@ -464,7 +464,7 @@ public: static Tile *flowerPot; static Tile *carrots; static Tile *potatoes; - static Tile *anvil; + static Tile *anvil; static Tile *netherQuartz; static Tile *quartzBlock; static Tile *stairs_quartz; @@ -636,9 +636,9 @@ public: virtual void playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr<Player> player); virtual void onRemoving(Level *level, int x, int y, int z, int data); virtual void handleRain(Level *level, int x, int y, int z); - virtual void levelTimeChanged(Level *level, int64_t delta, int64_t newTime); + virtual void levelTimeChanged(Level *level, __int64 delta, __int64 newTime); virtual void registerIcons(IconRegister *iconRegister); - virtual wstring getTileItemIconName(); + virtual wstring getTileItemIconName(); // 4J Using per-item textures now Tile *setTextureName(const wstring &name); // AP - added this function so we can generate the faceFlags for a block in a single fast function diff --git a/Minecraft.World/VoronoiZoom.cpp b/Minecraft.World/VoronoiZoom.cpp index f62cc9b6..78323dfa 100644 --- a/Minecraft.World/VoronoiZoom.cpp +++ b/Minecraft.World/VoronoiZoom.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "System.h" -VoronoiZoom::VoronoiZoom(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +VoronoiZoom::VoronoiZoom(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } diff --git a/Minecraft.World/VoronoiZoom.h b/Minecraft.World/VoronoiZoom.h index 43a8de66..c0738c90 100644 --- a/Minecraft.World/VoronoiZoom.h +++ b/Minecraft.World/VoronoiZoom.h @@ -5,7 +5,7 @@ class VoronoiZoom : public Layer { public: - VoronoiZoom(int64_t seedMixup, shared_ptr<Layer>parent); + VoronoiZoom(__int64 seedMixup, shared_ptr<Layer>parent); virtual intArray getArea(int xo, int yo, int w, int h); diff --git a/Minecraft.World/WaterLevelChunk.cpp b/Minecraft.World/WaterLevelChunk.cpp index 19f3e8a1..b6dbd05d 100644 --- a/Minecraft.World/WaterLevelChunk.cpp +++ b/Minecraft.World/WaterLevelChunk.cpp @@ -143,7 +143,7 @@ bool WaterLevelChunk::testSetBlocksAndData(byteArray data, int x0, int y0, int z return false; } -Random *WaterLevelChunk::getRandom(int64_t l) +Random *WaterLevelChunk::getRandom(__int64 l) { return new Random((level->getSeed() + x * x * 4987142 + x * 5947611 + z * z * 4392871l + z * 389711) ^ l); } diff --git a/Minecraft.World/WaterLevelChunk.h b/Minecraft.World/WaterLevelChunk.h index 43e7e0c6..18dc8a05 100644 --- a/Minecraft.World/WaterLevelChunk.h +++ b/Minecraft.World/WaterLevelChunk.h @@ -39,7 +39,7 @@ public: void setBlocks(byteArray newBlocks, int sub); int setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter; bool testSetBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p); - Random *getRandom(int64_t l); + Random *getRandom(__int64 l); virtual Biome *getBiome(int x, int z, BiomeSource *biomeSource); virtual void reSyncLighting() {}; // 4J added }; diff --git a/Minecraft.World/ZoneFile.cpp b/Minecraft.World/ZoneFile.cpp index 661cb7dd..fc1f36bf 100644 --- a/Minecraft.World/ZoneFile.cpp +++ b/Minecraft.World/ZoneFile.cpp @@ -6,7 +6,7 @@ const int ZoneFile::slotsLength = ZonedChunkStorage::CHUNKS_PER_ZONE * ZonedChunkStorage::CHUNKS_PER_ZONE; -ZoneFile::ZoneFile(int64_t key, File file, File entityFile) : slots(slotsLength) +ZoneFile::ZoneFile(__int64 key, File file, File entityFile) : slots(slotsLength) { lastUse = 0; diff --git a/Minecraft.World/ZoneFile.h b/Minecraft.World/ZoneFile.h index 5adb60ee..d7b8cc82 100644 --- a/Minecraft.World/ZoneFile.h +++ b/Minecraft.World/ZoneFile.h @@ -17,18 +17,18 @@ private: short slotCount; public: - int64_t lastUse; + __int64 lastUse; private: HANDLE channel; public: - int64_t key; + __int64 key; File file; NbtSlotFile *entityFile; - ZoneFile(int64_t key, File file, File entityFile); + ZoneFile(__int64 key, File file, File entityFile); ~ZoneFile(); void readHeader(); diff --git a/Minecraft.World/ZoneIo.cpp b/Minecraft.World/ZoneIo.cpp index 0bd2a637..f1838c86 100644 --- a/Minecraft.World/ZoneIo.cpp +++ b/Minecraft.World/ZoneIo.cpp @@ -2,7 +2,7 @@ #include "ByteBuffer.h" #include "ZoneIo.h" -ZoneIo::ZoneIo(HANDLE channel, int64_t pos) +ZoneIo::ZoneIo(HANDLE channel, __int64 pos) { this->channel = channel; this->pos = pos; diff --git a/Minecraft.World/ZoneIo.h b/Minecraft.World/ZoneIo.h index 59840564..22473583 100644 --- a/Minecraft.World/ZoneIo.h +++ b/Minecraft.World/ZoneIo.h @@ -7,10 +7,10 @@ class ZoneIo { private: HANDLE channel; - int64_t pos; + __int64 pos; public: - ZoneIo(HANDLE channel, int64_t pos); + ZoneIo(HANDLE channel, __int64 pos); void write(byteArray bb, int size); void write(ByteBuffer *bb, int size); ByteBuffer *read(int size); diff --git a/Minecraft.World/ZonedChunkStorage.cpp b/Minecraft.World/ZonedChunkStorage.cpp index aed408c6..b4ee8585 100644 --- a/Minecraft.World/ZonedChunkStorage.cpp +++ b/Minecraft.World/ZonedChunkStorage.cpp @@ -11,7 +11,7 @@ // 4J Stu - There are changes to this class for 1.8.2, but since we never use it anyway lets not worry about it const int ZonedChunkStorage::BIT_TERRAIN_POPULATED = 0x0000001; - + const int ZonedChunkStorage::CHUNKS_PER_ZONE_BITS = 5; // = 32 const int ZonedChunkStorage::CHUNKS_PER_ZONE = 1 << ZonedChunkStorage::CHUNKS_PER_ZONE_BITS; // ^2 @@ -50,7 +50,7 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) int xZone = x >> CHUNKS_PER_ZONE_BITS; int zZone = z >> CHUNKS_PER_ZONE_BITS; - int64_t key = xZone + (zZone << 20l); + __int64 key = xZone + (zZone << 20l); // 4J - was !zoneFiles.containsKey(key) if (zoneFiles.find(key) == zoneFiles.end()) { @@ -107,8 +107,8 @@ LevelChunk *ZonedChunkStorage::load(Level *level, int x, int z) header->flip(); int xOrg = header->getInt(); int zOrg = header->getInt(); - int64_t time = header->getLong(); - int64_t flags = header->getLong(); + __int64 time = header->getLong(); + __int64 flags = header->getLong(); lc->terrainPopulated = (flags & BIT_TERRAIN_POPULATED) != 0; @@ -121,7 +121,7 @@ LevelChunk *ZonedChunkStorage::load(Level *level, int x, int z) void ZonedChunkStorage::save(Level *level, LevelChunk *lc) { - int64_t flags = 0; + __int64 flags = 0; if (lc->terrainPopulated) flags |= BIT_TERRAIN_POPULATED; ByteBuffer *header = ByteBuffer::allocate(CHUNK_HEADER_SIZE); @@ -147,10 +147,10 @@ void ZonedChunkStorage::tick() tickCount++; if (tickCount % (20 * 10) == 4) { - vector<int64_t> toClose; + vector<__int64> toClose; AUTO_VAR(itEndZF, zoneFiles.end()); - for( unordered_map<int64_t, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEndZF; it++ ) + for( unordered_map<__int64, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEndZF; it++ ) { ZoneFile *zoneFile = it->second; if (tickCount - zoneFile->lastUse > 20 * 60) @@ -158,11 +158,11 @@ void ZonedChunkStorage::tick() toClose.push_back(zoneFile->key); } } - + AUTO_VAR(itEndTC, toClose.end()); for (AUTO_VAR(it, toClose.begin()); it != itEndTC; it++) { - int64_t key = *it ; //toClose[i]; + __int64 key = *it ; //toClose[i]; // 4J - removed try/catch // try { char buf[256]; @@ -181,7 +181,7 @@ void ZonedChunkStorage::tick() void ZonedChunkStorage::flush() { AUTO_VAR(itEnd, zoneFiles.end()); - for( unordered_map<int64_t, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEnd; it++ ) + for( unordered_map<__int64, ZoneFile *>::iterator it = zoneFiles.begin(); it != itEnd; it++ ) { ZoneFile *zoneFile = it->second; // 4J - removed try/catch diff --git a/Minecraft.World/ZonedChunkStorage.h b/Minecraft.World/ZonedChunkStorage.h index c8b89db9..ed7e3b65 100644 --- a/Minecraft.World/ZonedChunkStorage.h +++ b/Minecraft.World/ZonedChunkStorage.h @@ -14,24 +14,24 @@ class ZonedChunkStorage : public ChunkStorage { public: static const int BIT_TERRAIN_POPULATED; - + static const int CHUNKS_PER_ZONE_BITS; // = 32 static const int CHUNKS_PER_ZONE; // ^2 - + static const int CHUNK_WIDTH; - + static const int CHUNK_HEADER_SIZE; static const int CHUNK_SIZE; static const int CHUNK_LAYERS ; static const int CHUNK_SIZE_BYTES; - + static const ByteOrder BYTEORDER; File dir; private: - unordered_map<int64_t, ZoneFile *> zoneFiles; - int64_t tickCount; + unordered_map<__int64, ZoneFile *> zoneFiles; + __int64 tickCount; public: ZonedChunkStorage(File dir); diff --git a/Minecraft.World/ZoomLayer.cpp b/Minecraft.World/ZoomLayer.cpp index c2123785..bef24709 100644 --- a/Minecraft.World/ZoomLayer.cpp +++ b/Minecraft.World/ZoomLayer.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.newbiome.layer.h" #include "System.h" -ZoomLayer::ZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) +ZoomLayer::ZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup) { this->parent = parent; } @@ -81,7 +81,7 @@ int ZoomLayer::random(int a, int b, int c, int d) return d; } -shared_ptr<Layer>ZoomLayer::zoom(int64_t seed, shared_ptr<Layer> sup, int count) +shared_ptr<Layer>ZoomLayer::zoom(__int64 seed, shared_ptr<Layer> sup, int count) { shared_ptr<Layer>result = sup; for (int i = 0; i < count; i++) diff --git a/Minecraft.World/ZoomLayer.h b/Minecraft.World/ZoomLayer.h index 8ec93c8a..f865f088 100644 --- a/Minecraft.World/ZoomLayer.h +++ b/Minecraft.World/ZoomLayer.h @@ -5,7 +5,7 @@ class ZoomLayer : public Layer { public: - ZoomLayer(int64_t seedMixup, shared_ptr<Layer> parent); + ZoomLayer(__int64 seedMixup, shared_ptr<Layer> parent); virtual intArray getArea(int xo, int yo, int w, int h); @@ -14,5 +14,5 @@ protected: int random(int a, int b, int c, int d); public: - static shared_ptr<Layer> zoom(int64_t seed, shared_ptr<Layer>sup, int count); + static shared_ptr<Layer> zoom(__int64 seed, shared_ptr<Layer>sup, int count); };
\ No newline at end of file diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 065cd097..614f997b 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -9,7 +9,9 @@ #define AUTO_VAR(_var, _val) auto _var = _val #endif -#include <cstdint> +#if ( defined _XBOX || defined _WINDOWS64 || defined _DURANGO ) +typedef unsigned __int64 __uint64; +#endif #ifdef _WINDOWS64 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers diff --git a/Minecraft.World/system.cpp b/Minecraft.World/system.cpp index 69039921..72727e20 100644 --- a/Minecraft.World/system.cpp +++ b/Minecraft.World/system.cpp @@ -21,7 +21,7 @@ void System::arraycopy(arrayWithLength<BYTE> src, unsigned int srcPos, arrayWith assert( srcPos >=0 && srcPos <= src.length); assert( srcPos + length <= src.length ); assert( dstPos + length <= dst->length ); - + memcpy( dst->data + dstPos, src.data + srcPos, length); } @@ -30,7 +30,7 @@ void System::arraycopy(arrayWithLength<int> src, unsigned int srcPos, arrayWithL assert( srcPos >=0 && srcPos <= src.length); assert( srcPos + length <= src.length ); assert( dstPos + length <= dst->length ); - + memcpy( dst->data + dstPos, src.data + srcPos, length * sizeof(int) ); } @@ -47,10 +47,10 @@ void System::arraycopy(arrayWithLength<int> src, unsigned int srcPos, arrayWithL // long startTime = System.nanoTime(); // // ... the code being measured ... // long estimatedTime = System.nanoTime() - startTime; -// +// //Returns: //The current value of the system timer, in nanoseconds. -int64_t System::nanoTime() +__int64 System::nanoTime() { return GetTickCount() * 1000000LL; } @@ -58,21 +58,21 @@ int64_t System::nanoTime() //Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, //the granularity of the value depends on the underlying operating system and may be larger. For example, //many operating systems measure time in units of tens of milliseconds. -//See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" +//See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" //and coordinated universal time (UTC). // //Returns: //the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. -int64_t System::currentTimeMillis() +__int64 System::currentTimeMillis() { #ifdef __PS3__ -// 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 +// 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)); + __int64 msec = (sec * 1000) + (nsec / (1000*1000)); return msec; #elif defined __ORBIS__ @@ -85,7 +85,7 @@ int64_t System::currentTimeMillis() 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); + __int64 systTime = (((((((Time.day * 24) + Time.hour) * 60) + Time.minute) * 60) + Time.second) * 1000) + (Time.microsecond / 1000); return systTime;*/ #else @@ -106,12 +106,12 @@ int64_t System::currentTimeMillis() } // 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() +__int64 System::currentRealTimeMillis() { #ifdef __PSVITA__ SceDateTime Time; sceRtcGetCurrentClockLocalTime(&Time); - int64_t systTime = (((((((Time.day * 24) + Time.hour) * 60) + Time.minute) * 60) + Time.second) * 1000) + (Time.microsecond / 1000); + __int64 systTime = (((((((Time.day * 24) + Time.hour) * 60) + Time.minute) * 60) + Time.second) * 1000) + (Time.microsecond / 1000); return systTime; #else return currentTimeMillis(); @@ -175,9 +175,9 @@ void System::ReverseINT(int *piVal) pchVal1[3]=pchVal2[0]; } -void System::ReverseULONGLONG(int64_t *pullVal) +void System::ReverseULONGLONG(__int64 *pullVal) { - int64_t ullValue=*pullVal; + __int64 ullValue=*pullVal; unsigned char *pchVal1=(unsigned char *)pullVal; unsigned char *pchVal2=(unsigned char *)&ullValue; |
