fix: remove byte type alias

This commit is contained in:
Tropical
2026-03-06 05:03:37 -06:00
parent 09eae49d21
commit 15af35eef2
208 changed files with 700 additions and 701 deletions
@@ -104,7 +104,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
{
DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
DWORD dSize;
byte *dData = dlcHeader->getData(dSize);
uint8_t *dData = dlcHeader->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
// = loadGameRules(dData, dSize); //, strings);
@@ -126,7 +126,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
DWORD dSize;
byte *dData = dlcFile->getData(dSize);
uint8_t *dData = dlcFile->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
// = loadGameRules(dData, dSize); //, strings);
@@ -142,7 +142,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
}
}
LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize)
LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
{
LevelGenerationOptions *lgo = new LevelGenerationOptions();
lgo->setGrSource( new JustGrSource() );
@@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize)
}
// 4J-JEV: Reverse of saveGameRules.
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize)
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize)
{
app.DebugPrintf("GameRuleManager::LoadingGameRules:\n");
@@ -240,7 +240,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
}
// 4J-JEV: Reverse of loadGameRules.
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
{
if (m_currentGameRuleDefinitions == NULL &&
m_currentLevelGenerationOptions == NULL)
@@ -373,7 +373,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
m_currentGameRuleDefinitions->write(dos);
}
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
{
bool levelGenAdded = false;
bool gameRulesAdded = false;
@@ -40,10 +40,10 @@ public:
void loadGameRules(DLCPack *);
LevelGenerationOptions *loadGameRules(byte *dIn, UINT dSize);
void loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize);
LevelGenerationOptions *loadGameRules(uint8_t *dIn, UINT dSize);
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize);
void saveGameRules(byte **dOut, UINT *dSize);
void saveGameRules(uint8_t **dOut, UINT *dSize);
private:
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
@@ -51,7 +51,7 @@ private:
void writeRuleFile(DataOutputStream *dos);
public:
bool readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
private:
void readAttributes(DataInputStream *dis, vector<wstring> *tagsAndAtts, GameRuleDefinition *rule);
+2 -2
View File
@@ -406,8 +406,8 @@ void C_4JProfile::Initialise( DWORD dwTitleID,
{
for( int i = 0; i < 4; i++ )
{
profileData[i] = new byte[iGameDefinedDataSizeX4/4];
ZeroMemory(profileData[i],sizeof(byte)*iGameDefinedDataSizeX4/4);
profileData[i] = new uint8_t[iGameDefinedDataSizeX4/4];
ZeroMemory(profileData[i],sizeof(uint8_t)*iGameDefinedDataSizeX4/4);
// Set some sane initial values!
GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)profileData[i];
+1 -1
View File
@@ -995,7 +995,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr<Entity> e)
return false;
}
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, byte event)
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event)
{
shared_ptr<Packet> p = shared_ptr<EntityEventPacket>( new EntityEventPacket(e->entityId, event) );
server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p);
+1 -1
View File
@@ -98,7 +98,7 @@ protected:
public:
shared_ptr<Entity> getEntity(int id);
virtual bool addGlobalEntity(shared_ptr<Entity> e);
void broadcastEntityEvent(shared_ptr<Entity> e, byte event);
void broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event);
virtual shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks);
virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1);
@@ -194,7 +194,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
// 4J - changed to use new methods for lighting
chunk->setSkyLightDataAllBright();
// Arrays::fill(chunk->skyLight->data, (byte) 255);
// Arrays::fill(chunk->skyLight->data, (uint8_t) 255);
}
chunk->loaded = true;
+1 -1
View File
@@ -342,7 +342,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate)
else
{
// 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet
broadcast( shared_ptr<ChunkTilesUpdatePacket>( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (byte)changes, level) ) );
broadcast( shared_ptr<ChunkTilesUpdatePacket>( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (uint8_t)changes, level) ) );
for (int i = 0; i < changes; i++)
{
int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15);
@@ -1205,7 +1205,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr<SetCreativeModeSlotP
// 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map
data->x = centreXC;
data->z = centreZC;
data->dimension = (byte) player->level->dimension->id;
data->dimension = (uint8_t) player->level->dimension->id;
data->setDirty();
}
+1 -1
View File
@@ -210,7 +210,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
addPlayerToReceiving( player );
playerConnection->send( shared_ptr<LoginPacket>( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
(byte) level->dimension->id, (byte) level->getMaxBuildHeight(), (byte) getMaxPlayers(),
(uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(),
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) );
playerConnection->send( shared_ptr<SetSpawnPositionPacket>( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) );
@@ -687,7 +687,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
}
LevelChunk *chunk = NULL;
byte workingThreads;
uint8_t workingThreads;
bool chunkSet = false;
// Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage.
@@ -2114,7 +2114,7 @@ static bool alloc_dynbuffer(U32 size)
//
// 1. filled polygons. these are triangulated simple polygons and thus have
// roughly as many triangles as they have vertices. they use either 8- or
// 16-byte vertex formats; this makes a worst case of 6 bytes of indices
// 16-uint8_t vertex formats; this makes a worst case of 6 bytes of indices
// for every 8 bytes of vertex data.
// 2. strokes and edge antialiasing. they use a 16-byte vertex format and
// worst-case write a "double quadstrip" which has 4 triangles for every
@@ -386,8 +386,8 @@ void DurangoStatsDebugger::retrieveStats(int iPad)
// ----------------------------------------- //
byte runningThreads = 0;
byte *r_runningThreads = &runningThreads;
uint8_t runningThreads = 0;
uint8_t *r_runningThreads = &runningThreads;
if (xuid.toString().compare(L"") == 0)
{
@@ -282,7 +282,7 @@ void ChatIntegrationLayer::OnOutgoingChatPacketReady(
__in Microsoft::Xbox::GameChat::ChatPacketEventArgs^ args
)
{
byte *bytes;
uint8_t *bytes;
int byteCount;
GetBufferBytes(args->PacketBuffer, &bytes);
@@ -300,7 +300,7 @@ void ChatIntegrationLayer::OnOutgoingChatPacketReady(
void ChatIntegrationLayer::OnIncomingChatMessage(
unsigned int sessionAddress,
Platform::Array<byte>^ message
Platform::Array<uint8_t>^ message
)
{
// To integrate the Chat DLL in your game, change the following code to use your game's network layer.
@@ -797,7 +797,7 @@ void ChatIntegrationLayer::GetBufferBytes( __in Windows::Storage::Streams::IBuff
srcBufferByteAccess->Buffer(ppOut);
}
Windows::Storage::Streams::IBuffer^ ChatIntegrationLayer::ArrayToBuffer( __in Platform::Array<byte>^ array )
Windows::Storage::Streams::IBuffer^ ChatIntegrationLayer::ArrayToBuffer( __in Platform::Array<uint8_t>^ array )
{
Windows::Storage::Streams::DataWriter^ writer = ref new Windows::Storage::Streams::DataWriter();
writer->WriteBytes(array);
@@ -94,7 +94,7 @@ public:
/// <param name="uniqueRemoteConsoleIdentifier">A unique ID for the remote console</param>
void OnIncomingChatMessage(
unsigned int sessionAddress,
Platform::Array<byte>^ message
Platform::Array<uint8_t>^ message
);
/// <summary>
@@ -217,7 +217,7 @@ public:
private:
void GetBufferBytes( __in Windows::Storage::Streams::IBuffer^ buffer, __out byte** ppOut );
Windows::Storage::Streams::IBuffer^ ArrayToBuffer( __in Platform::Array<byte>^ array );
Windows::Storage::Streams::IBuffer^ ArrayToBuffer( __in Platform::Array<uint8_t>^ array );
Concurrency::critical_section m_lock;
Microsoft::Xbox::GameChat::ChatManager^ m_chatManager;
@@ -51,7 +51,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo,
do
{
BYTE byte = *pNextByte;
BYTE uint8_t = *pNextByte;
switch( connectionInfo->m_internalDataState )
{
case DQRConnectionInfo::ConnectionState_InternalHeaderByte:
@@ -123,7 +123,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo,
// We therefore have to be able to handle (and ignore) this being received more than once - hence the check of the bool above.
// At this point, the connection is considered properly active from the point of view of the host.
int sessionIndex = GetSessionIndexForSmallId(byte);
int sessionIndex = GetSessionIndexForSmallId(uint8_t);
if( sessionIndex != -1 )
{
connectionInfo->m_channelActive[channel] = true;
@@ -136,7 +136,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo,
DQRNetworkManager::LogCommentFormat(L"Session index of %d found for player with small id %d - attempting to resolve display name\n",sessionIndex,byte);
DQRNetworkPlayer *pPlayer = new DQRNetworkPlayer(this, DQRNetworkPlayer::DNP_TYPE_REMOTE, true, 0, sessionAddress);
pPlayer->SetSmallId(byte);
pPlayer->SetSmallId(uint8_t);
pPlayer->SetUID(PlayerUID(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data()));
HostGamertagResolveDetails *resolveDetails = new HostGamertagResolveDetails();
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static byte *s_dataWritten;
static uint8_t *s_dataWritten;
public:
static void Tick();
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static byte *s_dataWritten;
static uint8_t *s_dataWritten;
public:
static void Tick();
@@ -451,7 +451,7 @@ int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bo
// We add 4 bytes to the start so that we can signal compressed data
// And another 4 bytes to store the decompressed data size
unsigned int compLength = origFilesize+8;
byte *compData = (byte *)malloc( compLength );
uint8_t *compData = (uint8_t *)malloc( compLength );
Compression::UseDefaultThreadStorage();
Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize);
ZeroMemory(compData,8);
@@ -90,7 +90,7 @@ void pipe_select_interrupter::recreate()
void pipe_select_interrupter::interrupt()
{
char byte = 0;
char uint8_t = 0;
signed_size_type result = ::write(write_descriptor_, &byte, 1);
(void)result;
}
@@ -140,7 +140,7 @@ void socket_select_interrupter::recreate()
void socket_select_interrupter::interrupt()
{
char byte = 0;
char uint8_t = 0;
socket_ops::buf b;
socket_ops::init_buf(b, &byte, 1);
boost::system::error_code ec;
@@ -172,7 +172,7 @@ public:
// External Operations
void process_bit( bool bit );
void process_bits( unsigned char bits, std::size_t bit_count );
void process_byte( unsigned char byte );
void process_byte( unsigned char uint8_t );
void process_block( void const *bytes_begin, void const *bytes_end );
void process_bytes( void const *buffer, std::size_t byte_count );
@@ -223,14 +223,14 @@ public:
void reset( value_type new_rem = InitRem );
// External Operations
void process_byte( unsigned char byte );
void process_byte( unsigned char uint8_t );
void process_block( void const *bytes_begin, void const *bytes_end );
void process_bytes( void const *buffer, std::size_t byte_count );
value_type checksum() const;
// Operators
void operator ()( unsigned char byte );
void operator ()( unsigned char uint8_t );
value_type operator ()() const;
private:
@@ -777,7 +777,7 @@ crc_basic<Bits>::process_byte
unsigned char byte
)
{
process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(byte)
process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(uint8_t)
: byte), CHAR_BIT );
}
@@ -938,7 +938,7 @@ BOOST_CRC_OPTIMAL_NAME::process_byte
unsigned char byte
)
{
process_bytes( &byte, sizeof(byte) );
process_bytes( &byte, sizeof(uint8_t) );
}
template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
@@ -1004,7 +1004,7 @@ BOOST_CRC_OPTIMAL_NAME::operator ()
unsigned char byte
)
{
process_byte( byte );
process_byte( uint8_t );
}
template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
@@ -88,7 +88,7 @@ inline void sha1::reset()
inline void sha1::process_byte(unsigned char byte)
{
process_byte_impl(byte);
process_byte_impl(uint8_t);
// size_t max value = 0xFFFFFFFF
//if (bit_count_low + 8 >= 0x100000000) { // would overflow
@@ -20,9 +20,9 @@ public:
unsigned int minColour = ms_pTileData->stemTile_minColour;
unsigned int maxColour = ms_pTileData->stemTile_maxColour;
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
return colour;
@@ -360,7 +360,7 @@ void Tesselator_SPU::color(int r, int g, int b, int a)
col = (r << 24) | (g << 16) | (b << 8) | (a);
}
void Tesselator_SPU::color(byte r, byte g, byte b)
void Tesselator_SPU::color(uint8_t r, uint8_t g, uint8_t b)
{
color(r & 0xff, g & 0xff, b & 0xff);
}
@@ -723,9 +723,9 @@ void Tesselator_SPU::noColor()
void Tesselator_SPU::normal(float x, float y, float z)
{
hasNormal = true;
byte xx = (byte) (x * 127);
byte yy = (byte) (y * 127);
byte zz = (byte) (z * 127);
uint8_t xx = (uint8_t) (x * 127);
uint8_t yy = (uint8_t) (y * 127);
uint8_t zz = (uint8_t) (z * 127);
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
}
@@ -154,7 +154,7 @@ public:
void color(float r, float g, float b, float a);
void color(int r, int g, int b);
void color(int r, int g, int b, int a);
void color(byte r, byte g, byte b);
void color(uint8_t r, uint8_t g, uint8_t b);
void vertexUV(float x, float y, float z, float u, float v);
void vertex(float x, float y, float z);
void color(int c);
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static byte *s_dataWritten;
static uint8_t *s_dataWritten;
public:
static void Tick();
@@ -599,7 +599,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
compressor and decompressor must use exactly the same dictionary (see
inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely
The dictionary should consist of strings (uint8_t sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static byte *s_dataWritten;
static uint8_t *s_dataWritten;
public:
static void Tick();
@@ -2114,7 +2114,7 @@ static bool alloc_dynbuffer(U32 size)
//
// 1. filled polygons. these are triangulated simple polygons and thus have
// roughly as many triangles as they have vertices. they use either 8- or
// 16-byte vertex formats; this makes a worst case of 6 bytes of indices
// 16-uint8_t vertex formats; this makes a worst case of 6 bytes of indices
// for every 8 bytes of vertex data.
// 2. strokes and edge antialiasing. they use a 16-byte vertex format and
// worst-case write a "double quadstrip" which has 4 triangles for every
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static byte *s_dataWritten;
static uint8_t *s_dataWritten;
public:
static void Tick();
@@ -11,7 +11,7 @@ bool MinecraftDynamicConfigurations::s_bUpdatedConfigs[MinecraftDynamicConfigura
MinecraftDynamicConfigurations::EDynamic_Configs MinecraftDynamicConfigurations::s_eCurrentConfig = MinecraftDynamicConfigurations::eDynamic_Config_Max;
size_t MinecraftDynamicConfigurations::s_currentConfigSize = 0;
size_t MinecraftDynamicConfigurations::s_dataWrittenSize = 0;
byte *MinecraftDynamicConfigurations::s_dataWritten = NULL;
uint8_t *MinecraftDynamicConfigurations::s_dataWritten = NULL;
void MinecraftDynamicConfigurations::Tick()
{
@@ -90,7 +90,7 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult
{
if( HRESULT_SUCCEEDED(taskResult) )
{
s_dataWritten = new byte[s_currentConfigSize];
s_dataWritten = new uint8_t[s_currentConfigSize];
HRESULT hr = Sentient::SenDynamicConfigGetBytes(
s_eCurrentConfig,
s_currentConfigSize,
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static byte *s_dataWritten;
static uint8_t *s_dataWritten;
public:
static void Tick();
+2 -2
View File
@@ -136,7 +136,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
)
{
teleportDelay = 0;
packet = shared_ptr<TeleportEntityPacket>( new TeleportEntityPacket(e->entityId, xn, yn, zn, (byte) yRotn, (byte) xRotn) );
packet = shared_ptr<TeleportEntityPacket>( new TeleportEntityPacket(e->entityId, xn, yn, zn, (uint8_t) yRotn, (uint8_t) xRotn) );
// printf("%d: New teleport rot %d\n",e->entityId,yRotn);
yRotp = yRotn;
xRotp = xRotn;
@@ -262,7 +262,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360);
if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL)
{
broadcast(shared_ptr<RotateHeadPacket>(new RotateHeadPacket(e->entityId, (byte) yHeadRot)));
broadcast(shared_ptr<RotateHeadPacket>(new RotateHeadPacket(e->entityId, (uint8_t) yHeadRot)));
yHeadRotp = yHeadRot;
}
@@ -2598,9 +2598,9 @@ bool TileRenderer::tesselateDustInWorld( Tile* tt, int x, int y, int z )
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax );
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f));
uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f));
uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f));
uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
}
+17 -17
View File
@@ -57,7 +57,7 @@ C4JThread* GameRenderer::m_updateThread;
C4JThread::EventArray* GameRenderer::m_updateEvents;
bool GameRenderer::nearThingsToDo = false;
bool GameRenderer::updateRunning = false;
vector<byte *> GameRenderer::m_deleteStackByte;
vector<uint8_t *> GameRenderer::m_deleteStackByte;
vector<SparseLightStorage *> GameRenderer::m_deleteStackSparseLightStorage;
vector<CompressedTileStorage *> GameRenderer::m_deleteStackCompressedTileStorage;
vector<SparseDataStorage *> GameRenderer::m_deleteStackSparseDataStorage;
@@ -1112,7 +1112,7 @@ void GameRenderer::renderLevel(float a)
#ifdef MULTITHREAD_ENABLE
// Request that an item be deleted, when it is safe to do so
void GameRenderer::AddForDelete(byte *deleteThis)
void GameRenderer::AddForDelete(uint8_t *deleteThis)
{
EnterCriticalSection(&m_csDeleteStack);
m_deleteStackByte.push_back(deleteThis);
@@ -1869,9 +1869,9 @@ void GameRenderer::setupClearColor(float a)
{
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Clear_Colour );
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF);
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
fr = (float)redComponent/256;//0.02f;
fg = (float)greenComponent/256;//0.02f;
@@ -1881,9 +1881,9 @@ void GameRenderer::setupClearColor(float a)
{
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Clear_Colour );
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF);
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
fr = (float)redComponent/256;//0.6f;
fg = (float)greenComponent/256;//0.1f;
@@ -2025,9 +2025,9 @@ void GameRenderer::setupFog(int i, float alpha)
glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_In_Cloud_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF);
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//1.0f;
float gg = (float)greenComponent/256;//1.0f;
@@ -2057,9 +2057,9 @@ void GameRenderer::setupFog(int i, float alpha)
}
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF);
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//0.4f;
float gg = (float)greenComponent/256;//0.4f;
@@ -2082,9 +2082,9 @@ void GameRenderer::setupFog(int i, float alpha)
glFogf(GL_FOG_DENSITY, 2.0f); // was 0.06
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF);
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//0.4f;
float gg = (float)greenComponent/256;//0.3f;
+2 -2
View File
@@ -156,12 +156,12 @@ public:
static bool nearThingsToDo;
static bool updateRunning;
#endif
static vector<byte *> m_deleteStackByte;
static vector<uint8_t *> m_deleteStackByte;
static vector<SparseLightStorage *> m_deleteStackSparseLightStorage;
static vector<CompressedTileStorage *> m_deleteStackCompressedTileStorage;
static vector<SparseDataStorage *> m_deleteStackSparseDataStorage;
static CRITICAL_SECTION m_csDeleteStack;
static void AddForDelete(byte *deleteThis);
static void AddForDelete(uint8_t *deleteThis);
static void AddForDelete(SparseLightStorage *deleteThis);
static void AddForDelete(CompressedTileStorage *deleteThis);
static void AddForDelete(SparseDataStorage *deleteThis);
+4 -4
View File
@@ -329,7 +329,7 @@ void Tesselator::color(int r, int g, int b, int a)
col = (r << 24) | (g << 16) | (b << 8) | (a);
}
void Tesselator::color(byte r, byte g, byte b)
void Tesselator::color(uint8_t r, uint8_t g, uint8_t b)
{
color(r & 0xff, g & 0xff, b & 0xff);
}
@@ -1043,9 +1043,9 @@ void Tesselator::normal(float x, float y, float z)
int8_t zz = (int8_t) (z * 127);
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
#else
byte xx = (byte) (x * 127);
byte yy = (byte) (y * 127);
byte zz = (byte) (z * 127);
uint8_t xx = (uint8_t) (x * 127);
uint8_t yy = (uint8_t) (y * 127);
uint8_t zz = (uint8_t) (z * 127);
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
#endif
}
+1 -1
View File
@@ -138,7 +138,7 @@ public:
void color(float r, float g, float b, float a);
void color(int r, int g, int b);
void color(int r, int g, int b, int a);
void color(byte r, byte g, byte b);
void color(uint8_t r, uint8_t g, uint8_t b);
void vertexUV(float x, float y, float z, float u, float v);
void vertex(float x, float y, float z);
void color(int c);
+36 -36
View File
@@ -269,10 +269,10 @@ void Texture::writeAsBMP(const wstring &name)
// Write the header
outStream->writeShort((short)0x424d); // 0x0000: ID - 'BM'
int byteSize = width * height * 4 + 54;
outStream->writeByte((byte)(byteSize >> 0)); // 0x0002: Raw file size
outStream->writeByte((byte)(byteSize >> 8));
outStream->writeByte((byte)(byteSize >> 16));
outStream->writeByte((byte)(byteSize >> 24));
outStream->writeByte((uint8_t)(byteSize >> 0)); // 0x0002: Raw file size
outStream->writeByte((uint8_t)(byteSize >> 8));
outStream->writeByte((uint8_t)(byteSize >> 16));
outStream->writeByte((uint8_t)(byteSize >> 24));
outStream->writeInt(0); // 0x0006: Reserved
outStream->writeByte(54); // 0x000A: Start of pixel data
outStream->writeByte(0);
@@ -282,31 +282,31 @@ void Texture::writeAsBMP(const wstring &name)
outStream->writeByte(0);
outStream->writeByte(0);
outStream->writeByte(0);
outStream->writeByte((byte)(width >> 0)); // 0x0012: Image width, in pixels
outStream->writeByte((byte)(width >> 8));
outStream->writeByte((byte)(width >> 16));
outStream->writeByte((byte)(width >> 24));
outStream->writeByte((byte)(height >> 0)); // 0x0016: Image height, in pixels
outStream->writeByte((byte)(height >> 8));
outStream->writeByte((byte)(height >> 16));
outStream->writeByte((byte)(height >> 24));
outStream->writeByte((uint8_t)(width >> 0)); // 0x0012: Image width, in pixels
outStream->writeByte((uint8_t)(width >> 8));
outStream->writeByte((uint8_t)(width >> 16));
outStream->writeByte((uint8_t)(width >> 24));
outStream->writeByte((uint8_t)(height >> 0)); // 0x0016: Image height, in pixels
outStream->writeByte((uint8_t)(height >> 8));
outStream->writeByte((uint8_t)(height >> 16));
outStream->writeByte((uint8_t)(height >> 24));
outStream->writeByte(1); // 0x001A: Number of color planes, must be 1
outStream->writeByte(0);
outStream->writeByte(32); // 0x001C: Bit depth (32bpp)
outStream->writeByte(0);
outStream->writeInt(0); // 0x001E: Compression mode (BI_RGB, uncompressed)
int bufSize = width * height * 4;
outStream->writeInt((byte)(bufSize >> 0)); // 0x0022: Raw size of bitmap data
outStream->writeInt((byte)(bufSize >> 8));
outStream->writeInt((byte)(bufSize >> 16));
outStream->writeInt((byte)(bufSize >> 24));
outStream->writeInt((uint8_t)(bufSize >> 0)); // 0x0022: Raw size of bitmap data
outStream->writeInt((uint8_t)(bufSize >> 8));
outStream->writeInt((uint8_t)(bufSize >> 16));
outStream->writeInt((uint8_t)(bufSize >> 24));
outStream->writeInt(0); // 0x0026: Horizontal resolution in ppm
outStream->writeInt(0); // 0x002A: Vertical resolution in ppm
outStream->writeInt(0); // 0x002E: Palette size (0 to match bit depth)
outStream->writeInt(0); // 0x0032: Number of important colors, 0 for all
// Pixels follow in inverted Y order
byte[] bytes = new byte[width * height * 4];
byte[] bytes = new uint8_t[width * height * 4];
data.position(0);
data.get(bytes);
for (int y = height - 1; y >= 0; y--)
@@ -335,7 +335,7 @@ void Texture::writeAsPNG(const wstring &filename)
#if 0
BufferedImage *image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
ByteBuffer *buffer = this->getData();
byte[] bytes = new byte[width * height * 4];
byte[] bytes = new uint8_t[width * height * 4];
buffer.position(0);
buffer.get(bytes);
@@ -529,10 +529,10 @@ void Texture::transferFromBuffer(intArray buffer)
{
int texel = column + x * 4;
data[0]->position(0);
data[0]->put(texel + byteRemap[0], (byte)((buffer[texel >> 2] >> 24) & 0xff));
data[0]->put(texel + byteRemap[1], (byte)((buffer[texel >> 2] >> 16) & 0xff));
data[0]->put(texel + byteRemap[2], (byte)((buffer[texel >> 2] >> 8) & 0xff));
data[0]->put(texel + byteRemap[3], (byte)((buffer[texel >> 2] >> 0) & 0xff));
data[0]->put(texel + byteRemap[0], (uint8_t)((buffer[texel >> 2] >> 24) & 0xff));
data[0]->put(texel + byteRemap[1], (uint8_t)((buffer[texel >> 2] >> 16) & 0xff));
data[0]->put(texel + byteRemap[2], (uint8_t)((buffer[texel >> 2] >> 8) & 0xff));
data[0]->put(texel + byteRemap[3], (uint8_t)((buffer[texel >> 2] >> 0) & 0xff));
}
}
}
@@ -588,10 +588,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = (byte)((tempPixels[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (byte)((tempPixels[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (byte)((tempPixels[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (byte)((tempPixels[intIndex] >> 0) & 0xff);
tempBytes[byteIndex + byteRemap[0]] = (uint8_t)((tempPixels[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (uint8_t)((tempPixels[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (uint8_t)((tempPixels[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (uint8_t)((tempPixels[intIndex] >> 0) & 0xff);
}
}
@@ -640,10 +640,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = (byte)((tempData[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (byte)((tempData[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (byte)((tempData[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (byte)((tempData[intIndex] >> 0) & 0xff);
tempBytes[byteIndex + byteRemap[0]] = (uint8_t)((tempData[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (uint8_t)((tempData[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (uint8_t)((tempData[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (uint8_t)((tempData[intIndex] >> 0) & 0xff);
}
}
}
@@ -675,10 +675,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = (byte)((col >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (byte)((col >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (byte)((col >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (byte)((col >> 0) & 0xff);
tempBytes[byteIndex + byteRemap[0]] = (uint8_t)((col >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (uint8_t)((col >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (uint8_t)((col >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (uint8_t)((col >> 0) & 0xff);
}
}
@@ -828,7 +828,7 @@ void Texture::updateOnGPU()
// the ram based buffer to it any more inside RenderManager.TextureDataUpdate
unsigned char *newData = RenderManager.TextureData(width,height,data[0]->getBuffer(),0,C4JRender::TEXTURE_FORMAT_RxGyBzAw);
ByteBuffer *oldBuffer = data[0];
data[0] = new ByteBuffer(data[0]->getSize(), (byte*) newData);
data[0] = new ByteBuffer(data[0]->getSize(), (uint8_t*) newData);
delete oldBuffer;
newData += width * height * 4;
#else
@@ -847,7 +847,7 @@ void Texture::updateOnGPU()
// the ram based buffer to it any more inside RenderManager.TextureDataUpdate
RenderManager.TextureDataUpdate(0, 0,levelWidth,levelHeight,data[level]->getBuffer(),level);
ByteBuffer *oldBuffer = data[level];
data[level] = new ByteBuffer(data[level]->getSize(), (byte*) newData);
data[level] = new ByteBuffer(data[level]->getSize(), (uint8_t*) newData);
delete oldBuffer;
newData += levelWidth * levelHeight * 4;
#else
+12 -12
View File
@@ -555,15 +555,15 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp)
int b = (rawPixels[i]) & 0xff;
#ifdef _XBOX
newPixels[i * 4 + 0] = (byte) a;
newPixels[i * 4 + 1] = (byte) r;
newPixels[i * 4 + 2] = (byte) g;
newPixels[i * 4 + 3] = (byte) b;
newPixels[i * 4 + 0] = (uint8_t) a;
newPixels[i * 4 + 1] = (uint8_t) r;
newPixels[i * 4 + 2] = (uint8_t) g;
newPixels[i * 4 + 3] = (uint8_t) b;
#else
newPixels[i * 4 + 0] = (byte) r;
newPixels[i * 4 + 1] = (byte) g;
newPixels[i * 4 + 2] = (byte) b;
newPixels[i * 4 + 3] = (byte) a;
newPixels[i * 4 + 0] = (uint8_t) r;
newPixels[i * 4 + 1] = (uint8_t) g;
newPixels[i * 4 + 2] = (uint8_t) b;
newPixels[i * 4 + 3] = (uint8_t) a;
#endif
}
// 4J - now creating a buffer of the size we require dynamically
@@ -731,10 +731,10 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id)
b = bb;
}
newPixels[i * 4 + 0] = (byte) r;
newPixels[i * 4 + 1] = (byte) g;
newPixels[i * 4 + 2] = (byte) b;
newPixels[i * 4 + 3] = (byte) a;
newPixels[i * 4 + 0] = (uint8_t) r;
newPixels[i * 4 + 1] = (uint8_t) g;
newPixels[i * 4 + 2] = (uint8_t) b;
newPixels[i * 4 + 3] = (uint8_t) a;
}
ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically
pixels->put(newPixels);