Get rid of MSVC's __int64

Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
This commit is contained in:
void_17
2026-03-02 15:53:32 +07:00
parent d6ec138710
commit d63f79325f
308 changed files with 5371 additions and 5379 deletions

View File

@@ -454,7 +454,7 @@ void LevelRenderer::allChanged(int playerIndex)
zMaxChunk = zChunks;
// 4J removed - we now only fully clear this on exiting the game (setting level to NULL). Apart from that, the chunk rebuilding is responsible for maintaining this
// renderableTileEntities.clear();
// renderableTileEntities.clear();
for (int x = 0; x < xChunks; x++)
{
@@ -565,7 +565,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++)
{
TileEntityRenderDispatcher::instance->render(*it2, a);
TileEntityRenderDispatcher::instance->render(*it2, a);
}
}
@@ -895,7 +895,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
}
void LevelRenderer::renderSameAsLast(int layer, double alpha)
void LevelRenderer::renderSameAsLast(int layer, double alpha)
{
for (int i = 0; i < RENDERLISTS_LENGTH; i++)
{
@@ -1127,7 +1127,7 @@ void LevelRenderer::renderSky(float alpha)
glPopMatrix();
// 4J - can't work out what this big black box is for. Taking it out until someone misses it... it causes a big black box to visible appear in 3rd person mode whilst under the ground.
#if 0
#if 0
float ss = 1;
float yo = -(float) (yy + 65);
float y0 = -ss;
@@ -1200,7 +1200,7 @@ void LevelRenderer::renderHaloRing(float alpha)
// Rough lumninance calculation
float Y = (sr+sr+sb+sg+sg+sg)/6;
float br = 0.6f + (Y*0.4f);
float br = 0.6f + (Y*0.4f);
//app.DebugPrintf("Luminance = %f, brightness = %f\n", Y, br);
glColor3f(br,br,br);
@@ -1369,7 +1369,7 @@ void LevelRenderer::createCloudMesh()
t->vertexUV(x0, y0, z0, u, v );
t->vertexUV(x1, y0, z0, u, v );
t->vertexUV(x1, y0, z1, u, v );
t->vertexUV(x0, y0, z1, u, v );
t->vertexUV(x0, y0, z1, u, v );
}
}
t->end();
@@ -1469,7 +1469,7 @@ void LevelRenderer::createCloudMesh()
t->vertexUV(x0, y1, z0, u, v );
t->vertexUV(x1, y1, z0, u, v );
t->vertexUV(x1, y0, z0, u, v );
t->vertexUV(x0, y0, z0, u, v );
t->vertexUV(x0, y0, z0, u, v );
}
}
t->end();
@@ -1491,10 +1491,10 @@ void LevelRenderer::createCloudMesh()
float z1 = z0 + 1.0f;
t->color(0.8f, 0.8f, 0.8f, 0.8f);
t->normal(1, 0, 0);
t->vertexUV(x0, y0, z1, u, v );
t->vertexUV(x0, y0, z1, u, v );
t->vertexUV(x1, y0, z1, u, v );
t->vertexUV(x1, y1, z1, u, v );
t->vertexUV(x0, y1, z1, u, v );
t->vertexUV(x0, y1, z1, u, v );
}
}
t->end();
@@ -1773,7 +1773,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha)
t->end();
#endif
}
}
}
}
glColor4f(1, 1, 1, 1.0f);
@@ -1910,14 +1910,14 @@ bool LevelRenderer::updateDirtyChunks()
{
// It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game
// So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it
shared_ptr<LocalPlayer> player = mc->localplayers[p];
shared_ptr<LocalPlayer> player = mc->localplayers[p];
if( player == NULL ) continue;
if( chunks[p].data == NULL ) continue;
if( level[p] == NULL ) continue;
if( chunks[p].length != xChunks * zChunks * CHUNK_Y_COUNT ) continue;
int px = (int)player->x;
int py = (int)player->y;
int pz = (int)player->z;
int pz = (int)player->z;
// app.DebugPrintf("!! %d %d %d, %d %d %d {%d,%d} ",px,py,pz,stackChunkDirty,nonStackChunkDirty,onlyRebuild, xChunks, zChunks);
@@ -1932,7 +1932,7 @@ bool LevelRenderer::updateDirtyChunks()
ClipChunk *pClipChunk = &chunks[p][(z * yChunks + y) * xChunks + x];
// Get distance to this chunk - deliberately not calling the chunk's method of doing this to avoid overheads (passing entitie, type conversion etc.) that this involves
int xd = pClipChunk->xm - px;
int yd = pClipChunk->ym - py;
int yd = pClipChunk->ym - py;
int zd = pClipChunk->zm - pz;
int distSq = xd * xd + yd * yd + zd * zd;
int distSqWeighted = xd * xd + yd * yd * 4 + zd * zd; // Weighting against y to prioritise things in same x/z plane as player first
@@ -1974,7 +1974,7 @@ bool LevelRenderer::updateDirtyChunks()
// emptiness without actually testing as many data items as uncompressed data would.
Chunk *chunk = pClipChunk->chunk;
LevelChunk *lc = level[p]->getChunkAt(chunk->x,chunk->z);
if( !lc->isRenderChunkEmpty(y * 16) )
if( !lc->isRenderChunkEmpty(y * 16) )
{
nearChunk = pClipChunk;
minDistSq = distSqWeighted;
@@ -2014,7 +2014,7 @@ bool LevelRenderer::updateDirtyChunks()
PIXEndNamedEvent();
}
Chunk *chunk = NULL;
#ifdef _LARGE_WORLDS
@@ -2058,21 +2058,21 @@ bool LevelRenderer::updateDirtyChunks()
if((veryNearCount > 0))
bAtomic = true; //MGH - if veryNearCount, then we're trying to rebuild atomically, so do it all on the main thread
if( bAtomic || (index == 0) )
if( bAtomic || (index == 0) )
{
//PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z);
// static __int64 totalTime = 0;
// static __int64 countTime = 0;
// __int64 startTime = System::currentTimeMillis();
// static int64_t totalTime = 0;
// static int64_t countTime = 0;
// int64_t startTime = System::currentTimeMillis();
//app.DebugPrintf("Rebuilding permaChunk %d\n", index);
permaChunk[index].rebuild();
permaChunk[index].rebuild();
if(index !=0)
if(index !=0)
s_rebuildCompleteEvents->Set(index-1); // MGH - this rebuild happening on the main thread instead, mark the thread it should have been running on as complete
// __int64 endTime = System::currentTimeMillis();
// int64_t endTime = System::currentTimeMillis();
// totalTime += (endTime - startTime);
// countTime++;
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);
@@ -2111,11 +2111,11 @@ bool LevelRenderer::updateDirtyChunks()
static Chunk permaChunk;
permaChunk.makeCopyForRebuild(chunk);
LeaveCriticalSection(&m_csDirtyChunks);
// static __int64 totalTime = 0;
// static __int64 countTime = 0;
// __int64 startTime = System::currentTimeMillis();
// static int64_t totalTime = 0;
// static int64_t countTime = 0;
// int64_t startTime = System::currentTimeMillis();
permaChunk.rebuild();
// __int64 endTime = System::currentTimeMillis();
// int64_t endTime = System::currentTimeMillis();
// totalTime += (endTime - startTime);
// countTime++;
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);
@@ -2315,7 +2315,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
{
// 4J - level is passed if this is coming from setTilesDirty, which could come from when connection is being ticked outside of normal level tick, and player won't
// be set up
if( level == NULL ) level = this->level[mc->player->GetXboxPad()];
if( level == NULL ) level = this->level[mc->player->GetXboxPad()];
// EnterCriticalSection(&m_csDirtyChunks);
int _x0 = Mth::intFloorDiv(x0, CHUNK_XZSIZE);
int _y0 = Mth::intFloorDiv(y0, CHUNK_SIZE);
@@ -2346,10 +2346,10 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
// AP - by the time we reach this function the area passed in has a 1 block border added to it to make sure geometry and lighting is updated correctly.
// Some of those blocks will only need lighting updated so it is acceptable to not have those blocks grouped in the deferral system as the mismatch
// will hardly be noticable. The blocks that need geometry updated will be adjacent to the original, non-bordered area.
// will hardly be noticable. The blocks that need geometry updated will be adjacent to the original, non-bordered area.
// This bit of code will mark a chunk as 'non-critical' if all of the blocks inside it are NOT adjacent to the original area. This has the greatest effect
// when digging a single block. Only 6 of the blocks out of the possible 26 are actually adjacent to the original block. The other 20 only need lighting updated.
// Note I have noticed a new side effect of this system where it's possible to see into the sides of water but this is acceptable compared to seeing through
// Note I have noticed a new side effect of this system where it's possible to see into the sides of water but this is acceptable compared to seeing through
// the entire landscape.
// is the left or right most block just inside this chunk
if( ((x0 & 15) == 15 && x == _x0) || ((x1 & 15) == 0 && x == _x1) )
@@ -2376,7 +2376,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
dirtyChunksLockFreeStack.Push((int *)(index));
#else
dirtyChunksLockFreeStack.Push((int *)(index + 2));
dirtyChunksLockFreeStack.Push((int *)(index + 2));
#endif
#ifdef _XBOX
@@ -2489,7 +2489,7 @@ void LevelRenderer::cull_SPU(int playerIndex, Culler *culler, float a)
m_jobPort_CullSPU->submitSync();
// static int doSort = false;
// if(doSort)
{
{
m_jobPort_CullSPU->submitJob(&sortJob);
}
// doSort ^= 1;
@@ -2591,7 +2591,7 @@ void LevelRenderer::playSound(shared_ptr<Entity> entity,int iSound, double x, do
}
// 4J-PB - original function. I've changed to an enum instead of string compares
// 4J removed -
// 4J removed -
/*
void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za)
{
@@ -2751,7 +2751,7 @@ shared_ptr<Particle> LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle
float fStart=((float)(cStart&0xFF));
float fDiff=(float)((cEnd-cStart)&0xFF);
float fCol = (fStart + (Math::random() * fDiff))/255.0f;
float fCol = (fStart + (Math::random() * fDiff))/255.0f;
particle->setColor( fCol, fCol, fCol );
}
}
@@ -2885,11 +2885,11 @@ void LevelRenderer::entityAdded(shared_ptr<Entity> entity)
//if (entity->customTextureUrl2 != L"") textures->addHttpTexture(entity->customTextureUrl2, new MobSkinTextureProcessor());
// 4J-PB - adding these from global title storage
if (entity->customTextureUrl != L"")
if (entity->customTextureUrl != L"")
{
textures->addMemTexture(entity->customTextureUrl, new MobSkinMemTextureProcessor());
}
if (entity->customTextureUrl2 != L"")
if (entity->customTextureUrl2 != L"")
{
textures->addMemTexture(entity->customTextureUrl2, new MobSkinMemTextureProcessor());
}
@@ -2905,11 +2905,11 @@ void LevelRenderer::entityRemoved(shared_ptr<Entity> entity)
if (entity->customTextureUrl != L"") textures->removeHttpTexture(entity->customTextureUrl);
if (entity->customTextureUrl2 != L"") textures->removeHttpTexture(entity->customTextureUrl2);
*/
if (entity->customTextureUrl != L"")
if (entity->customTextureUrl != L"")
{
textures->removeMemTexture(entity->customTextureUrl);
}
if (entity->customTextureUrl2 != L"")
if (entity->customTextureUrl2 != L"")
{
textures->removeMemTexture(entity->customTextureUrl2);
}
@@ -2944,7 +2944,7 @@ void LevelRenderer::levelEvent(shared_ptr<Player> source, int type, int x, int y
{
//case LevelEvent::SOUND_WITHER_BOSS_SPAWN:
case LevelEvent::SOUND_DRAGON_DEATH:
if (mc->cameraTargetPlayer != NULL)
if (mc->cameraTargetPlayer != NULL)
{
// play the sound at an offset from the player
double dx = x - mc->cameraTargetPlayer->x;
@@ -2956,7 +2956,7 @@ void LevelRenderer::levelEvent(shared_ptr<Player> source, int type, int x, int y
double sy = mc->cameraTargetPlayer->y;
double sz = mc->cameraTargetPlayer->z;
if (len > 0)
if (len > 0)
{
sx += (dx / len) * 2;
sy += (dy / len) * 2;
@@ -3185,7 +3185,7 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
if (progress < 0 || progress >= 10)
{
AUTO_VAR(it, destroyingBlocks.find(id));
if(it != destroyingBlocks.end())
if(it != destroyingBlocks.end())
{
delete it->second;
destroyingBlocks.erase(it);
@@ -3373,7 +3373,7 @@ unsigned char LevelRenderer::incGlobalChunkRefCount(int x, int y, int z, Level *
unsigned char refCount = (flags >> CHUNK_FLAG_REF_SHIFT ) & CHUNK_FLAG_REF_MASK;
refCount++;
flags &= ~(CHUNK_FLAG_REF_MASK<<CHUNK_FLAG_REF_SHIFT);
flags |= refCount << CHUNK_FLAG_REF_SHIFT;
flags |= refCount << CHUNK_FLAG_REF_SHIFT;
globalChunkFlags[ index ] = flags;
return refCount;
@@ -3545,7 +3545,7 @@ void LevelRenderer::DestroyedTileManager::addAABBs( Level *level, AABB *box, AAB
// without worrying about the lifespan of the copy we've passed out
if( m_destroyedTiles[i]->boxes[j]->intersects( box ) )
{
boxes->push_back(AABB::newTemp( m_destroyedTiles[i]->boxes[j]->x0,
boxes->push_back(AABB::newTemp( m_destroyedTiles[i]->boxes[j]->x0,
m_destroyedTiles[i]->boxes[j]->y0,
m_destroyedTiles[i]->boxes[j]->z0,
m_destroyedTiles[i]->boxes[j]->x1,