209 changed files with 8800 additions and 788 deletions
+36
View File
@@ -0,0 +1,36 @@
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04
ENV DEBIAN_FRONTEND=noninteractive
# Dependencies
RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt-get install -y \
build-essential \
cmake \
libglfw3-dev \
libgl-dev \
libglu1-mesa-dev \
libopenal-dev \
libvorbis-dev \
libpng-dev \
libpthread-stubs0-dev \
lld \
meson \
ninja-build \
gcc-15 \
g++-15 \
# Clean up lol
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Set GCC 15 as default
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 100 \
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100 \
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100
ENV DEBIAN_FRONTEND=dialog
+17
View File
@@ -0,0 +1,17 @@
{
"name": "4JCraft Dev Container",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"mesonbuild.mesonbuild"
]
}
},
"remoteUser": "vscode"
}
+34 -75
View File
@@ -11,6 +11,9 @@
#include <cmath>
#include <pthread.h>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
C4JRender RenderManager;
static GLFWwindow *s_window = nullptr;
@@ -495,106 +498,62 @@ void C4JRender::TextureDynamicUpdateEnd() {}
void C4JRender::Tick() {}
void C4JRender::UpdateGamma(unsigned short) {}
// really don't know if this is nessesary but didn't find any other functions to load images properly as a png..
// im sorry.
#ifdef __linux__
#include <png.h>
#include <stdio.h>
#include <string.h>
static HRESULT LoadPNGFromRows(png_structp png, png_infop info, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut)
// This sucks, but at least better than libpng
static HRESULT LoadFromSTB(unsigned char* data, int width, int height, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
int width = png_get_image_width(png, info);
int height = png_get_image_height(png, info);
png_byte color_type = png_get_color_type(png, info);
png_byte bit_depth = png_get_bit_depth(png, info);
int pixelCount = width * height;
int* pixels = new int[pixelCount];
if (bit_depth == 16) png_set_strip_16(png);
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png);
if (png_get_valid(png, info, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png);
if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_PALETTE)
png_set_filler(png, 0xFF, PNG_FILLER_AFTER);
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png);
png_read_update_info(png, info);
unsigned char *buf = new unsigned char[width * height * 4];
png_bytep *rows = new png_bytep[height];
for (int y = 0; y < height; y++)
rows[y] = buf + y * width * 4;
png_read_image(png, rows);
delete[] rows;
// considering i worked on previous projects with raw pngs,,,,,
int *pixels = new int[width * height];
for (int i = 0; i < width * height; i++)
for (int i = 0; i < pixelCount; i++)
{
unsigned char r = buf[i * 4 + 0];
unsigned char g = buf[i * 4 + 1];
unsigned char b = buf[i * 4 + 2];
unsigned char a = buf[i * 4 + 3];
unsigned char r = data[i * 4 + 0];
unsigned char g = data[i * 4 + 1];
unsigned char b = data[i * 4 + 2];
unsigned char a = data[i * 4 + 3];
//pixels[i] = (a << 24) | (b << 16) | (g << 8) | r;
pixels[i] = (a << 24) | (r << 16) | (g << 8) | b;
}
delete[] buf;
pSrcInfo->Width = width;
pSrcInfo->Height = height;
if (pSrcInfo)
{
pSrcInfo->Width = width;
pSrcInfo->Height = height;
}
*ppDataOut = pixels;
return S_OK;
}
HRESULT C4JRender::LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut)
HRESULT C4JRender::LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
FILE *fp = fopen(szFilename, "rb");
if (!fp) return E_FAIL;
int width, height, channels;
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png) { fclose(fp); return E_FAIL; }
png_infop info = png_create_info_struct(png);
if (!info) { png_destroy_read_struct(&png, NULL, NULL); fclose(fp); return E_FAIL; }
if (setjmp(png_jmpbuf(png))) { png_destroy_read_struct(&png, &info, NULL); fclose(fp); return E_FAIL; }
unsigned char* data = stbi_load(szFilename, &width, &height, &channels, 4);
if (!data)
return E_FAIL;
png_init_io(png, fp);
png_read_info(png, info);
HRESULT hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);
HRESULT hr = LoadPNGFromRows(png, info, pSrcInfo, ppDataOut);
png_destroy_read_struct(&png, &info, NULL);
fclose(fp);
stbi_image_free(data);
return hr;
}
struct PNGMemReader { const unsigned char *data; png_size_t pos; png_size_t size; };
static void png_mem_read(png_structp png, png_bytep out, png_size_t len)
HRESULT C4JRender::LoadTextureData(BYTE* pbData, DWORD dwBytes, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
PNGMemReader *r = (PNGMemReader *)png_get_io_ptr(png);
if (r->pos + len > r->size) len = r->size - r->pos;
memcpy(out, r->data + r->pos, len);
r->pos += len;
}
int width, height, channels;
HRESULT C4JRender::LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut)
{
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png) return E_FAIL;
png_infop info = png_create_info_struct(png);
if (!info) { png_destroy_read_struct(&png, NULL, NULL); return E_FAIL; }
if (setjmp(png_jmpbuf(png))) { png_destroy_read_struct(&png, &info, NULL); return E_FAIL; }
unsigned char* data = stbi_load_from_memory(pbData, dwBytes, &width, &height, &channels, 4);
if (!data)
return E_FAIL;
PNGMemReader reader = { pbData, 0, dwBytes };
png_set_read_fn(png, &reader, png_mem_read);
png_read_info(png, info);
HRESULT hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);
HRESULT hr = LoadPNGFromRows(png, info, pSrcInfo, ppDataOut);
png_destroy_read_struct(&png, &info, NULL);
stbi_image_free(data);
return hr;
}
#else
HRESULT C4JRender::LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) { return S_OK; }
HRESULT C4JRender::LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) { return S_OK; }
#endif
HRESULT C4JRender::SaveTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut) { return S_OK; }
HRESULT C4JRender::SaveTextureDataToMemory(void *pOutput, int outputCapacity, int *outputLength, int width, int height, int *ppDataIn) { return S_OK; }
void C4JRender::TextureGetStats() {}
File diff suppressed because it is too large Load Diff
@@ -104,7 +104,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
{
DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
DWORD dSize;
uint8_t *dData = dlcHeader->getData(dSize);
byte *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;
uint8_t *dData = dlcFile->getData(dSize);
byte *dData = dlcFile->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
// = loadGameRules(dData, dSize); //, strings);
@@ -142,7 +142,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
}
}
LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize)
{
LevelGenerationOptions *lgo = new LevelGenerationOptions();
lgo->setGrSource( new JustGrSource() );
@@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
}
// 4J-JEV: Reverse of saveGameRules.
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize)
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize)
{
app.DebugPrintf("GameRuleManager::LoadingGameRules:\n");
@@ -240,7 +240,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
}
// 4J-JEV: Reverse of loadGameRules.
void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
void GameRuleManager::saveGameRules(byte **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, uint8_t *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *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(uint8_t *dIn, UINT dSize);
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize);
LevelGenerationOptions *loadGameRules(byte *dIn, UINT dSize);
void loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize);
void saveGameRules(uint8_t **dOut, UINT *dSize);
void saveGameRules(byte **dOut, UINT *dSize);
private:
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
@@ -51,7 +51,7 @@ private:
void writeRuleFile(DataOutputStream *dos);
public:
bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
bool readRuleFile(LevelGenerationOptions *lgo, byte *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 uint8_t[iGameDefinedDataSizeX4/4];
ZeroMemory(profileData[i],sizeof(uint8_t)*iGameDefinedDataSizeX4/4);
profileData[i] = new byte[iGameDefinedDataSizeX4/4];
ZeroMemory(profileData[i],sizeof(byte)*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, uint8_t event)
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, byte 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, uint8_t event);
void broadcastEntityEvent(shared_ptr<Entity> e, byte 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, (uint8_t) 255);
// Arrays::fill(chunk->skyLight->data, (byte) 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, (uint8_t)changes, level) ) );
broadcast( shared_ptr<ChunkTilesUpdatePacket>( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (byte)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 = (uint8_t) player->level->dimension->id;
data->dimension = (byte) 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(),
(uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(),
(byte) level->dimension->id, (byte) level->getMaxBuildHeight(), (byte) 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;
uint8_t workingThreads;
byte workingThreads;
bool chunkSet = false;
// Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage.
@@ -386,8 +386,8 @@ void DurangoStatsDebugger::retrieveStats(int iPad)
// ----------------------------------------- //
uint8_t runningThreads = 0;
uint8_t *r_runningThreads = &runningThreads;
byte runningThreads = 0;
byte *r_runningThreads = &runningThreads;
if (xuid.toString().compare(L"") == 0)
{
@@ -282,7 +282,7 @@ void ChatIntegrationLayer::OnOutgoingChatPacketReady(
__in Microsoft::Xbox::GameChat::ChatPacketEventArgs^ args
)
{
uint8_t *bytes;
byte *bytes;
int byteCount;
GetBufferBytes(args->PacketBuffer, &bytes);
@@ -300,7 +300,7 @@ void ChatIntegrationLayer::OnOutgoingChatPacketReady(
void ChatIntegrationLayer::OnIncomingChatMessage(
unsigned int sessionAddress,
Platform::Array<uint8_t>^ message
Platform::Array<byte>^ 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<uint8_t>^ array )
Windows::Storage::Streams::IBuffer^ ChatIntegrationLayer::ArrayToBuffer( __in Platform::Array<byte>^ 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<uint8_t>^ message
Platform::Array<byte>^ 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<uint8_t>^ array );
Windows::Storage::Streams::IBuffer^ ArrayToBuffer( __in Platform::Array<byte>^ array );
Concurrency::critical_section m_lock;
Microsoft::Xbox::GameChat::ChatManager^ m_chatManager;
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static uint8_t *s_dataWritten;
static byte *s_dataWritten;
public:
static void Tick();
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static uint8_t *s_dataWritten;
static byte *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;
uint8_t *compData = (uint8_t *)malloc( compLength );
byte *compData = (byte *)malloc( compLength );
Compression::UseDefaultThreadStorage();
Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize);
ZeroMemory(compData,8);
@@ -777,7 +777,7 @@ crc_basic<Bits>::process_byte
unsigned char byte
)
{
process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(uint8_t)
process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(byte)
: byte), CHAR_BIT );
}
@@ -938,7 +938,7 @@ BOOST_CRC_OPTIMAL_NAME::process_byte
unsigned char byte
)
{
process_bytes( &byte, sizeof(uint8_t) );
process_bytes( &byte, sizeof(byte) );
}
template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
@@ -1004,7 +1004,7 @@ BOOST_CRC_OPTIMAL_NAME::operator ()
unsigned char byte
)
{
process_byte( uint8_t );
process_byte( byte );
}
template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
@@ -20,9 +20,9 @@ public:
unsigned int minColour = ms_pTileData->stemTile_minColour;
unsigned int maxColour = ms_pTileData->stemTile_maxColour;
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));
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));
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(uint8_t r, uint8_t g, uint8_t b)
void Tesselator_SPU::color(byte r, byte g, byte 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;
uint8_t xx = (uint8_t) (x * 127);
uint8_t yy = (uint8_t) (y * 127);
uint8_t zz = (uint8_t) (z * 127);
byte xx = (byte) (x * 127);
byte yy = (byte) (y * 127);
byte zz = (byte) (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(uint8_t r, uint8_t g, uint8_t b);
void color(byte r, byte g, byte 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 uint8_t *s_dataWritten;
static byte *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 (uint8_t sequences) that are likely
The dictionary should consist of strings (byte 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 uint8_t *s_dataWritten;
static byte *s_dataWritten;
public:
static void Tick();
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize;
static size_t s_dataWrittenSize;
static uint8_t *s_dataWritten;
static byte *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;
uint8_t *MinecraftDynamicConfigurations::s_dataWritten = NULL;
byte *MinecraftDynamicConfigurations::s_dataWritten = NULL;
void MinecraftDynamicConfigurations::Tick()
{
@@ -90,7 +90,7 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult
{
if( HRESULT_SUCCEEDED(taskResult) )
{
s_dataWritten = new uint8_t[s_currentConfigSize];
s_dataWritten = new byte[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 uint8_t *s_dataWritten;
static byte *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, (uint8_t) yRotn, (uint8_t) xRotn) );
packet = shared_ptr<TeleportEntityPacket>( new TeleportEntityPacket(e->entityId, xn, yn, zn, (byte) yRotn, (byte) 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, (uint8_t) yHeadRot)));
broadcast(shared_ptr<RotateHeadPacket>(new RotateHeadPacket(e->entityId, (byte) 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 );
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));
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));
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<uint8_t *> GameRenderer::m_deleteStackByte;
vector<byte *> 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(uint8_t *deleteThis)
void GameRenderer::AddForDelete(byte *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 );
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte 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 );
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte 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 );
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte 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 );
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte 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 );
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte 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<uint8_t *> m_deleteStackByte;
static vector<byte *> 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(uint8_t *deleteThis);
static void AddForDelete(byte *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(uint8_t r, uint8_t g, uint8_t b)
void Tesselator::color(byte r, byte g, byte 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
uint8_t xx = (uint8_t) (x * 127);
uint8_t yy = (uint8_t) (y * 127);
uint8_t zz = (uint8_t) (z * 127);
byte xx = (byte) (x * 127);
byte yy = (byte) (y * 127);
byte zz = (byte) (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(uint8_t r, uint8_t g, uint8_t b);
void color(byte r, byte g, byte 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);
@@ -225,7 +225,7 @@ Texture *StitchedTexture::getSource()
Texture *StitchedTexture::getFrame(int i)
{
return frames->at(0);
return frames->at(i);
}
int StitchedTexture::getFrames()
+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((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->writeByte((byte)(byteSize >> 0)); // 0x0002: Raw file size
outStream->writeByte((byte)(byteSize >> 8));
outStream->writeByte((byte)(byteSize >> 16));
outStream->writeByte((byte)(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((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((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(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((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((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(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 uint8_t[width * height * 4];
byte[] bytes = new byte[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 uint8_t[width * height * 4];
byte[] bytes = new byte[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], (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));
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));
}
}
}
@@ -588,10 +588,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
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);
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);
}
}
@@ -640,10 +640,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
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);
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);
}
}
}
@@ -675,10 +675,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
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);
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);
}
}
@@ -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(), (uint8_t*) newData);
data[0] = new ByteBuffer(data[0]->getSize(), (byte*) 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(), (uint8_t*) newData);
data[level] = new ByteBuffer(data[level]->getSize(), (byte*) 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] = (uint8_t) a;
newPixels[i * 4 + 1] = (uint8_t) r;
newPixels[i * 4 + 2] = (uint8_t) g;
newPixels[i * 4 + 3] = (uint8_t) b;
newPixels[i * 4 + 0] = (byte) a;
newPixels[i * 4 + 1] = (byte) r;
newPixels[i * 4 + 2] = (byte) g;
newPixels[i * 4 + 3] = (byte) b;
#else
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;
newPixels[i * 4 + 0] = (byte) r;
newPixels[i * 4 + 1] = (byte) g;
newPixels[i * 4 + 2] = (byte) b;
newPixels[i * 4 + 3] = (byte) 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] = (uint8_t) r;
newPixels[i * 4 + 1] = (uint8_t) g;
newPixels[i * 4 + 2] = (uint8_t) b;
newPixels[i * 4 + 3] = (uint8_t) a;
newPixels[i * 4 + 0] = (byte) r;
newPixels[i * 4 + 1] = (byte) g;
newPixels[i * 4 + 2] = (byte) b;
newPixels[i * 4 + 3] = (byte) a;
}
ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically
pixels->put(newPixels);
+3 -3
View File
@@ -181,9 +181,9 @@ void FallingTile::causeFallDamage(float distance)
void FallingTile::addAdditonalSaveData(CompoundTag *tag)
{
tag->putByte(L"Tile", (uint8_t) tile);
tag->putByte(L"Data", (uint8_t) data);
tag->putByte(L"Time", (uint8_t) time);
tag->putByte(L"Tile", (byte) tile);
tag->putByte(L"Data", (byte) data);
tag->putByte(L"Time", (byte) time);
tag->putBoolean(L"DropItem", dropItem);
tag->putBoolean(L"HurtEntities", hurtEntities);
tag->putFloat(L"FallHurtAmount", fallDamageAmount);
+3 -3
View File
@@ -353,9 +353,9 @@ void RedStoneDustTile::animateTick(Level *level, int x, int y, int z, Random *ra
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax );
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));
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));
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
}
+3 -3
View File
@@ -126,9 +126,9 @@ int StemTile::getColor(int data)
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMax );
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));
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));
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
return colour;
@@ -308,7 +308,7 @@ void BrewingStandTileEntity::save(CompoundTag *base)
if (items[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) i);
tag->putByte(L"Slot", (byte) i);
items[i]->save(tag);
listTag->add(tag);
}
@@ -121,7 +121,7 @@ void ChestTileEntity::save(CompoundTag *base)
if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) i);
tag->putByte(L"Slot", (byte) i);
items->data[i]->save(tag);
listTag->add(tag);
}
@@ -174,7 +174,7 @@ void DispenserTileEntity::save(CompoundTag *base)
if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) i);
tag->putByte(L"Slot", (byte) i);
items->data[i]->save(tag);
listTag->add(tag);
}
@@ -129,7 +129,7 @@ void FurnaceTileEntity::save(CompoundTag *base)
if ((*items)[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) i);
tag->putByte(L"Slot", (byte) i);
(*items)[i]->save(tag);
listTag->add(tag);
}
@@ -33,7 +33,7 @@ void MusicTileEntity::load(CompoundTag *tag)
void MusicTileEntity::tune()
{
note = (uint8_t) ((note + 1) % 25);
note = (byte) ((note + 1) % 25);
setChanged();
}
@@ -10,7 +10,7 @@ public:
static TileEntity *create() { return new MusicTileEntity(); }
public:
uint8_t note;
byte note;
bool on;
+1 -1
View File
@@ -21,7 +21,7 @@ template <class T> void System::arraycopy(arrayWithLength<T> src, unsigned int s
ArrayCopyFunctionDefinition(Node *)
ArrayCopyFunctionDefinition(Biome *)
void System::arraycopy(arrayWithLength<uint8_t> src, unsigned int srcPos, arrayWithLength<uint8_t> *dst, unsigned int dstPos, unsigned int length)
void System::arraycopy(arrayWithLength<byte> src, unsigned int srcPos, arrayWithLength<byte> *dst, unsigned int dstPos, unsigned int length)
{
assert( srcPos >=0 && srcPos <= src.length);
assert( srcPos + length <= src.length );
+1 -1
View File
@@ -15,7 +15,7 @@ class System
template <class T> static void arraycopy(arrayWithLength<T> src, unsigned int srcPos, arrayWithLength<T> *dst, unsigned int dstPos, unsigned int length);
public:
ArrayCopyFunctionDeclaration(uint8_t)
ArrayCopyFunctionDeclaration(byte)
ArrayCopyFunctionDeclaration(Node *)
ArrayCopyFunctionDeclaration(Biome *)
ArrayCopyFunctionDeclaration(int)
+4 -4
View File
@@ -202,7 +202,7 @@ public:
bool IsHost();
bool IsGuest();
bool IsLocal();
PlayerUID GetXuid();
PlayerUID GetXuid();
LPCWSTR GetGamertag();
int GetSessionIndex();
bool IsTalking();
@@ -383,7 +383,7 @@ typedef struct _XMARKETPLACE_CONTENTOFFER_INFO
DWORD dwPointsPrice;
} XMARKETPLACE_CONTENTOFFER_INFO, *PXMARKETPLACE_CONTENTOFFER_INFO;
typedef enum
typedef enum
{
XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002,
XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = 0x00000020,
@@ -403,7 +403,7 @@ const int QNET_SENDDATA_SEQUENTIAL = 0;
struct XRNM_SEND_BUFFER
{
DWORD dwDataSize;
uint8_t *pbyData;
byte *pbyData;
};
const int D3DBLEND_CONSTANTALPHA = 0;
@@ -531,7 +531,7 @@ typedef struct {
// const int XC_LANGUAGE_POLISH =17;
// const int XC_LANGUAGE_TURKISH =18;
// const int XC_LANGUAGE_LATINAMERICANSPANISH =19;
//
//
// const int XC_LANGUAGE_GREEK =20;
// #else
// const int XC_LANGUAGE_UKENGLISH =11;
+2 -2
View File
@@ -475,7 +475,7 @@ ListTag<CompoundTag> *Inventory::save(ListTag<CompoundTag> *listTag)
if (items[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) i);
tag->putByte(L"Slot", (byte) i);
items[i]->save(tag);
listTag->add(tag);
}
@@ -485,7 +485,7 @@ ListTag<CompoundTag> *Inventory::save(ListTag<CompoundTag> *listTag)
if (armor[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) (i + 100));
tag->putByte(L"Slot", (byte) (i + 100));
armor[i]->save(tag);
listTag->add(tag);
}
@@ -85,7 +85,7 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr<ItemInstance
void MerchantRecipeList::writeToStream(DataOutputStream *stream)
{
stream->writeByte((uint8_t) (m_recipes.size() & 0xff));
stream->writeByte((byte) (m_recipes.size() & 0xff));
for (int i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *r = m_recipes.at(i);
+5 -5
View File
@@ -340,7 +340,7 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter
// resetPos();
setPos(0, 0, 0);
entityData->define(DATA_SHARED_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_SHARED_FLAGS_ID, (byte) 0);
entityData->define(DATA_AIR_SUPPLY_ID, TOTAL_AIR_SUPPLY); // 4J Stu - Brought forward from 1.2.3 to fix 38654 - Gameplay: Player will take damage when air bubbles are present if resuming game from load/autosave underwater.
// 4J Stu - We cannot call virtual functions in ctors, as at this point the object
@@ -1677,7 +1677,7 @@ void Entity::lerpMotion(double xd, double yd, double zd)
this->zd = zd;
}
void Entity::handleEntityEvent(uint8_t eventId)
void Entity::handleEntityEvent(byte eventId)
{
}
@@ -1781,14 +1781,14 @@ bool Entity::getSharedFlag(int flag)
void Entity::setSharedFlag(int flag, bool value)
{
uint8_t currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID);
byte currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID);
if (value)
{
entityData->set(DATA_SHARED_FLAGS_ID, (uint8_t) (currentValue | (1 << flag)));
entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue | (1 << flag)));
}
else
{
entityData->set(DATA_SHARED_FLAGS_ID, (uint8_t) (currentValue & ~(1 << flag)));
entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue & ~(1 << flag)));
}
}
+1 -1
View File
@@ -303,7 +303,7 @@ public:
virtual Vec3 *getLookAngle();
virtual void handleInsidePortal();
virtual void lerpMotion(double xd, double yd, double zd);
virtual void handleEntityEvent(uint8_t eventId);
virtual void handleEntityEvent(byte eventId);
virtual void animateHurt();
virtual void prepareCustomTextures();
virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[]
+5 -5
View File
@@ -236,7 +236,7 @@ void HangingEntity::push(double xa, double ya, double za)
void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
{
tag->putByte(L"Direction", (uint8_t) dir);
tag->putByte(L"Direction", (byte) dir);
tag->putInt(L"TileX", xTile);
tag->putInt(L"TileY", yTile);
tag->putInt(L"TileZ", zTile);
@@ -245,16 +245,16 @@ void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
switch (dir)
{
case Direction::NORTH:
tag->putByte(L"Dir", (uint8_t) 0);
tag->putByte(L"Dir", (byte) 0);
break;
case Direction::WEST:
tag->putByte(L"Dir", (uint8_t) 1);
tag->putByte(L"Dir", (byte) 1);
break;
case Direction::SOUTH:
tag->putByte(L"Dir", (uint8_t) 2);
tag->putByte(L"Dir", (byte) 2);
break;
case Direction::EAST:
tag->putByte(L"Dir", (uint8_t) 3);
tag->putByte(L"Dir", (byte) 3);
break;
}
}
+1 -1
View File
@@ -202,7 +202,7 @@ bool ItemEntity::hurt(DamageSource *source, int damage)
void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putShort(L"Health", (uint8_t) health);
entityTag->putShort(L"Health", (byte) health);
entityTag->putShort(L"Age", (short) age);
if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag()));
}
+1 -1
View File
@@ -1591,7 +1591,7 @@ shared_ptr<ItemInstance> Mob::getArmor(int pos)
//return equipment[pos + 1];
}
void Mob::handleEntityEvent(uint8_t id)
void Mob::handleEntityEvent(byte id)
{
if (id == EntityEvent::HURT)
{
+1 -1
View File
@@ -324,7 +324,7 @@ public:
virtual int getMaxSpawnClusterSize();
virtual shared_ptr<ItemInstance> getCarriedItem();
virtual shared_ptr<ItemInstance> getArmor(int pos);
virtual void handleEntityEvent(uint8_t id);
virtual void handleEntityEvent(byte id);
virtual bool isSleeping();
virtual Icon *getItemInHandIcon(shared_ptr<ItemInstance> item, int layer);
virtual bool shouldRender(Vec3 *c);
+10 -10
View File
@@ -116,7 +116,7 @@ Arrow::Arrow(Level *level, shared_ptr<Mob> mob, float power) : Entity( level )
void Arrow::defineSynchedData()
{
entityData->define(ID_FLAGS, (uint8_t) 0);
entityData->define(ID_FLAGS, (byte) 0);
}
@@ -432,11 +432,11 @@ void Arrow::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"inData", (uint8_t) lastData);
tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->putByte(L"pickup", (uint8_t) pickup);
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"inData", (byte) lastData);
tag->putByte(L"shake", (byte) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->putByte(L"pickup", (byte) pickup);
tag->putDouble(L"damage", baseDamage);
}
@@ -513,19 +513,19 @@ bool Arrow::isAttackable()
void Arrow::setCritArrow(bool critArrow)
{
uint8_t flags = entityData->getByte(ID_FLAGS);
byte flags = entityData->getByte(ID_FLAGS);
if (critArrow)
{
entityData->set(ID_FLAGS, (uint8_t) (flags | FLAG_CRIT));
entityData->set(ID_FLAGS, (byte) (flags | FLAG_CRIT));
}
else
{
entityData->set(ID_FLAGS, (uint8_t) (flags & ~FLAG_CRIT));
entityData->set(ID_FLAGS, (byte) (flags & ~FLAG_CRIT));
}
}
bool Arrow::isCritArrow()
{
uint8_t flags = entityData->getByte(ID_FLAGS);
byte flags = entityData->getByte(ID_FLAGS);
return (flags & FLAG_CRIT) != 0;
}
+2 -2
View File
@@ -44,7 +44,7 @@ void Blaze::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_FLAGS_ID, (byte) 0);
}
int Blaze::getAmbientSound()
@@ -209,7 +209,7 @@ bool Blaze::isCharged()
void Blaze::setCharged(bool value)
{
uint8_t flags = entityData->getByte(DATA_FLAGS_ID);
byte flags = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
flags |= 0x1;
+5 -5
View File
@@ -63,8 +63,8 @@ void Creeper::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_SWELL_DIR, (uint8_t) -1);
entityData->define(DATA_IS_POWERED, (uint8_t) 0);
entityData->define(DATA_SWELL_DIR, (byte) -1);
entityData->define(DATA_IS_POWERED, (byte) 0);
}
void Creeper::addAdditonalSaveData(CompoundTag *entityTag)
@@ -76,7 +76,7 @@ void Creeper::addAdditonalSaveData(CompoundTag *entityTag)
void Creeper::readAdditionalSaveData(CompoundTag *tag)
{
Monster::readAdditionalSaveData(tag);
entityData->set(DATA_IS_POWERED, (uint8_t) (tag->getBoolean(L"powered") ? 1 : 0));
entityData->set(DATA_IS_POWERED, (byte) (tag->getBoolean(L"powered") ? 1 : 0));
}
void Creeper::tick()
@@ -159,11 +159,11 @@ int Creeper::getSwellDir()
void Creeper::setSwellDir(int dir)
{
entityData->set(DATA_SWELL_DIR, (uint8_t) dir);
entityData->set(DATA_SWELL_DIR, (byte) dir);
}
void Creeper::thunderHit(const LightningBolt *lightningBolt)
{
Monster::thunderHit(lightningBolt);
entityData->set(DATA_IS_POWERED, (uint8_t) 1);
entityData->set(DATA_IS_POWERED, (byte) 1);
}
+6 -6
View File
@@ -63,9 +63,9 @@ void EnderMan::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_CARRY_ITEM_ID, (uint8_t) 0);
entityData->define(DATA_CARRY_ITEM_DATA, (uint8_t) 0);
entityData->define(DATA_CREEPY, (uint8_t) 0);
entityData->define(DATA_CARRY_ITEM_ID, (byte) 0);
entityData->define(DATA_CARRY_ITEM_DATA, (byte) 0);
entityData->define(DATA_CREEPY, (byte) 0);
}
void EnderMan::addAdditonalSaveData(CompoundTag *tag)
@@ -368,7 +368,7 @@ void EnderMan::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
// 4J Brought forward from 1.2.3 to help fix Enderman behaviour
void EnderMan::setCarryingTile(int carryingTile)
{
entityData->set(DATA_CARRY_ITEM_ID, (uint8_t) (carryingTile & 0xff));
entityData->set(DATA_CARRY_ITEM_ID, (byte) (carryingTile & 0xff));
}
int EnderMan::getCarryingTile()
@@ -378,7 +378,7 @@ int EnderMan::getCarryingTile()
void EnderMan::setCarryingData(int carryingData)
{
entityData->set(DATA_CARRY_ITEM_DATA, (uint8_t) (carryingData & 0xff));
entityData->set(DATA_CARRY_ITEM_DATA, (byte) (carryingData & 0xff));
}
int EnderMan::getCarryingData()
@@ -406,5 +406,5 @@ bool EnderMan::isCreepy()
void EnderMan::setCreepy(bool creepy)
{
entityData->set(DATA_CREEPY, (uint8_t)(creepy ? 1 : 0));
entityData->set(DATA_CREEPY, (byte)(creepy ? 1 : 0));
}
@@ -175,7 +175,7 @@ bool ExperienceOrb::hurt(DamageSource *source, int damage)
void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putShort(L"Health", (uint8_t) health);
entityTag->putShort(L"Health", (byte) health);
entityTag->putShort(L"Age", (short) age);
entityTag->putShort(L"Value", (short) value);
}
+2 -2
View File
@@ -320,8 +320,8 @@ void Fireball::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->put(L"direction", this->newDoubleList(3, this->xd, this->yd, this->zd));
}
@@ -381,9 +381,9 @@ void FishingHook::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"shake", (byte) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
}
void FishingHook::readAdditionalSaveData(CompoundTag *tag)
+4 -4
View File
@@ -66,7 +66,7 @@ void Ghast::defineSynchedData()
{
FlyingMob::defineSynchedData();
entityData->define(DATA_IS_CHARGING, (uint8_t) 0);
entityData->define(DATA_IS_CHARGING, (byte) 0);
}
int Ghast::getMaxHealth()
@@ -77,7 +77,7 @@ int Ghast::getMaxHealth()
void Ghast::tick()
{
FlyingMob::tick();
uint8_t current = entityData->getByte(DATA_IS_CHARGING);
byte current = entityData->getByte(DATA_IS_CHARGING);
// this->textureName = current == 1 ? L"/mob/ghast_fire.png" : L"/mob/ghast.png"; // 4J replaced with following line
this->textureIdx = current == 1 ? TN_MOB_GHAST_FIRE : TN_MOB_GHAST;
}
@@ -174,8 +174,8 @@ void Ghast::serverAiStep()
if (!level->isClientSide)
{
uint8_t old = entityData->getByte(DATA_IS_CHARGING);
uint8_t current = (uint8_t) (charge > 10 ? 1 : 0);
byte old = entityData->getByte(DATA_IS_CHARGING);
byte current = (byte) (charge > 10 ? 1 : 0);
if (old != current)
{
entityData->set(DATA_IS_CHARGING, current);
+3 -3
View File
@@ -36,7 +36,7 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H
void ItemFrame::defineSynchedData()
{
getEntityData()->defineNULL(DATA_ITEM, NULL);
getEntityData()->define(DATA_ROTATION, (uint8_t) 0);
getEntityData()->define(DATA_ROTATION, (byte) 0);
}
void ItemFrame::dropItem()
@@ -79,7 +79,7 @@ int ItemFrame::getRotation()
void ItemFrame::setRotation(int rotation)
{
getEntityData()->set(DATA_ROTATION, (uint8_t) (rotation % 4));
getEntityData()->set(DATA_ROTATION, (byte) (rotation % 4));
}
void ItemFrame::addAdditonalSaveData(CompoundTag *tag)
@@ -87,7 +87,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag)
if (getItem() != NULL)
{
tag->putCompound(L"Item", getItem()->save(new CompoundTag()));
tag->putByte(L"ItemRotation", (uint8_t) getRotation());
tag->putByte(L"ItemRotation", (byte) getRotation());
//tag->putFloat(L"ItemDropChance", dropChance);
}
HangingEntity::addAdditonalSaveData(tag);
+4 -4
View File
@@ -128,7 +128,7 @@ bool Minecart::makeStepSound()
void Minecart::defineSynchedData()
{
entityData->define(DATA_ID_FUEL, (uint8_t) 0);
entityData->define(DATA_ID_FUEL, (byte) 0);
entityData->define(DATA_ID_HURT, 0);
entityData->define(DATA_ID_HURTDIR, 1);
entityData->define(DATA_ID_DAMAGE, 0);
@@ -861,7 +861,7 @@ void Minecart::addAdditonalSaveData(CompoundTag *base)
if ( (*items)[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (uint8_t) i);
tag->putByte(L"Slot", (byte) i);
(*items)[i]->save(tag);
listTag->add(tag);
}
@@ -1158,11 +1158,11 @@ void Minecart::setHasFuel(bool fuel)
{
if (fuel)
{
entityData->set(DATA_ID_FUEL, (uint8_t) (entityData->getByte(DATA_ID_FUEL) | 1));
entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) | 1));
}
else
{
entityData->set(DATA_ID_FUEL, (uint8_t) (entityData->getByte(DATA_ID_FUEL) & ~1));
entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) & ~1));
}
}
+2 -2
View File
@@ -60,7 +60,7 @@ void Ozelot::defineSynchedData()
{
TamableAnimal::defineSynchedData();
entityData->define(DATA_TYPE_ID, (uint8_t) TYPE_OZELOT);
entityData->define(DATA_TYPE_ID, (byte) TYPE_OZELOT);
}
void Ozelot::serverAiMobStep()
@@ -294,7 +294,7 @@ int Ozelot::getCatType()
void Ozelot::setCatType(int type)
{
entityData->set(DATA_TYPE_ID, (uint8_t) type);
entityData->set(DATA_TYPE_ID, (byte) type);
}
bool Ozelot::canSpawn()
+3 -3
View File
@@ -64,7 +64,7 @@ bool Pig::canBeControlledByRider()
void Pig::defineSynchedData()
{
Animal::defineSynchedData();
entityData->define(DATA_SADDLE_ID, (uint8_t) 0);
entityData->define(DATA_SADDLE_ID, (byte) 0);
}
void Pig::addAdditonalSaveData(CompoundTag *tag)
@@ -142,11 +142,11 @@ void Pig::setSaddle(bool value)
{
if (value)
{
entityData->set(DATA_SADDLE_ID, (uint8_t) 1);
entityData->set(DATA_SADDLE_ID, (byte) 1);
}
else
{
entityData->set(DATA_SADDLE_ID, (uint8_t) 0);
entityData->set(DATA_SADDLE_ID, (byte) 0);
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ void PrimedTnt::explode()
void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putByte(L"Fuse", (uint8_t) life);
entityTag->putByte(L"Fuse", (byte) life);
}
void PrimedTnt::readAdditionalSaveData(CompoundTag *tag)
+8 -8
View File
@@ -100,7 +100,7 @@ void Sheep::defineSynchedData()
Animal::defineSynchedData();
// sheared and color share a byte
entityData->define(DATA_WOOL_ID, ((uint8_t) 0)); //was new Byte((uint8_t), 0)
entityData->define(DATA_WOOL_ID, ((byte) 0)); //was new Byte((byte), 0)
}
void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
@@ -117,7 +117,7 @@ int Sheep::getDeathLoot()
return Tile::cloth_Id;
}
void Sheep::handleEntityEvent(uint8_t id)
void Sheep::handleEntityEvent(byte id)
{
if (id == EntityEvent::EAT_GRASS)
{
@@ -195,7 +195,7 @@ void Sheep::addAdditonalSaveData(CompoundTag *tag)
{
Animal::addAdditonalSaveData(tag);
tag->putBoolean(L"Sheared", isSheared());
tag->putByte(L"Color", (uint8_t) getColor());
tag->putByte(L"Color", (byte) getColor());
}
void Sheep::readAdditionalSaveData(CompoundTag *tag)
@@ -227,8 +227,8 @@ int Sheep::getColor()
void Sheep::setColor(int color)
{
uint8_t current = entityData->getByte(DATA_WOOL_ID);
entityData->set(DATA_WOOL_ID, (uint8_t) ((current & 0xf0) | (color & 0x0f)));
byte current = entityData->getByte(DATA_WOOL_ID);
entityData->set(DATA_WOOL_ID, (byte) ((current & 0xf0) | (color & 0x0f)));
}
bool Sheep::isSheared()
@@ -238,14 +238,14 @@ bool Sheep::isSheared()
void Sheep::setSheared(bool value)
{
uint8_t current = entityData->getByte(DATA_WOOL_ID);
byte current = entityData->getByte(DATA_WOOL_ID);
if (value)
{
entityData->set(DATA_WOOL_ID, (uint8_t) (current | 0x10));
entityData->set(DATA_WOOL_ID, (byte) (current | 0x10));
}
else
{
entityData->set(DATA_WOOL_ID, (uint8_t) (current & ~0x10));
entityData->set(DATA_WOOL_ID, (byte) (current & ~0x10));
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ public:
virtual int getDeathLoot();
public:
virtual void handleEntityEvent(uint8_t id);
virtual void handleEntityEvent(byte id);
public:
float getHeadEatPositionScale(float a);
+2 -2
View File
@@ -47,12 +47,12 @@ void Slime::defineSynchedData()
{
Mob::defineSynchedData();
entityData->define(ID_SIZE, (uint8_t) 1);
entityData->define(ID_SIZE, (byte) 1);
}
void Slime::setSize(int size)
{
entityData->set(ID_SIZE, (uint8_t) size);
entityData->set(ID_SIZE, (byte) size);
Mob::setSize(0.6f * size, 0.6f * size);
this->setPos(x, y, z);
setHealth(getMaxHealth());
+2 -2
View File
@@ -31,7 +31,7 @@ void Spider::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_FLAGS_ID, (byte) 0);
}
void Spider::tick()
@@ -179,7 +179,7 @@ bool Spider::isClimbing()
void Spider::setClimbing(bool value)
{
uint8_t flags = entityData->getByte(DATA_FLAGS_ID);
byte flags = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
flags |= 0x1;
+1 -1
View File
@@ -701,7 +701,7 @@ int Villager::getPurchaseCost(int itemId, Random *random)
return minMax.first + random->nextInt(minMax.second - minMax.first);
}
void Villager::handleEntityEvent(uint8_t id)
void Villager::handleEntityEvent(byte id)
{
if (id == EntityEvent::LOVE_HEARTS)
{
+1 -1
View File
@@ -86,7 +86,7 @@ public:
void setLastHurtByMob(shared_ptr<Mob> mob);
void die(DamageSource *source);
void handleEntityEvent(uint8_t id);
void handleEntityEvent(byte id);
private:
void addParticlesAroundSelf(ePARTICLE_TYPE particle);
@@ -56,7 +56,7 @@ VillagerGolem::VillagerGolem(Level *level) : Golem(level)
void VillagerGolem::defineSynchedData()
{
Golem::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_FLAGS_ID, (byte) 0);
}
bool VillagerGolem::useNewAi()
@@ -143,7 +143,7 @@ bool VillagerGolem::doHurtTarget(shared_ptr<Entity> target)
return hurt;
}
void VillagerGolem::handleEntityEvent(uint8_t id)
void VillagerGolem::handleEntityEvent(byte id)
{
if (id == EntityEvent::START_ATTACKING)
{
@@ -219,14 +219,14 @@ bool VillagerGolem::isPlayerCreated()
void VillagerGolem::setPlayerCreated(bool value)
{
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
byte current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x01));
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01));
}
else
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x01));
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01));
}
}
@@ -44,7 +44,7 @@ public:
virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag);
virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual void handleEntityEvent(uint8_t id);
virtual void handleEntityEvent(byte id);
virtual shared_ptr<Village> getVillage();
virtual int getAttackAnimationTick();
virtual void offerFlower(bool offer);
+11 -11
View File
@@ -91,8 +91,8 @@ void Wolf::defineSynchedData()
{
TamableAnimal::defineSynchedData();
entityData->define(DATA_HEALTH_ID, getHealth());
entityData->define(DATA_INTERESTED_ID, (uint8_t)0);
entityData->define(DATA_COLLAR_COLOR, (uint8_t) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED));
entityData->define(DATA_INTERESTED_ID, (byte)0);
entityData->define(DATA_COLLAR_COLOR, (byte) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED));
}
bool Wolf::makeStepSound()
@@ -118,7 +118,7 @@ void Wolf::addAdditonalSaveData(CompoundTag *tag)
TamableAnimal::addAdditonalSaveData(tag);
tag->putBoolean(L"Angry", isAngry());
tag->putByte(L"CollarColor", (uint8_t) getCollarColor());
tag->putByte(L"CollarColor", (byte) getCollarColor());
}
void Wolf::readAdditionalSaveData(CompoundTag *tag)
@@ -424,7 +424,7 @@ bool Wolf::interact(shared_ptr<Player> player)
return TamableAnimal::interact(player);
}
void Wolf::handleEntityEvent(uint8_t id)
void Wolf::handleEntityEvent(byte id)
{
if (id == EntityEvent::SHAKE_WETNESS)
{
@@ -471,14 +471,14 @@ bool Wolf::isAngry()
void Wolf::setAngry(bool value)
{
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
byte current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x02));
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x02));
}
else
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x02));
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x02));
}
}
@@ -489,7 +489,7 @@ int Wolf::getCollarColor()
void Wolf::setCollarColor(int color)
{
entityData->set(DATA_COLLAR_COLOR, (uint8_t) (color & 0xF));
entityData->set(DATA_COLLAR_COLOR, (byte) (color & 0xF));
}
// 4J-PB added for tooltips
@@ -520,15 +520,15 @@ shared_ptr<AgableMob> Wolf::getBreedOffspring(shared_ptr<AgableMob> target)
void Wolf::setIsInterested(bool value)
{
//uint8_t current = entityData->getByte(DATA_INTERESTED_ID);
//byte current = entityData->getByte(DATA_INTERESTED_ID);
if (value)
{
entityData->set(DATA_INTERESTED_ID, (uint8_t) 1);
entityData->set(DATA_INTERESTED_ID, (byte) 1);
}
else
{
entityData->set(DATA_INTERESTED_ID, (uint8_t) 0);
entityData->set(DATA_INTERESTED_ID, (byte) 0);
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ public:
virtual bool hurt(DamageSource *source, int dmg);
virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual bool interact(shared_ptr<Player> player);
virtual void handleEntityEvent(uint8_t id);
virtual void handleEntityEvent(byte id);
float getTailAngle();
virtual bool isFood(shared_ptr<ItemInstance> item);
virtual int getMaxSpawnClusterSize();
+10 -10
View File
@@ -55,9 +55,9 @@ void Zombie::defineSynchedData()
{
Monster::defineSynchedData();
getEntityData()->define(DATA_BABY_ID, (uint8_t) 0);
getEntityData()->define(DATA_VILLAGER_ID, (uint8_t) 0);
getEntityData()->define(DATA_CONVERTING_ID, (uint8_t) 0);
getEntityData()->define(DATA_BABY_ID, (byte) 0);
getEntityData()->define(DATA_VILLAGER_ID, (byte) 0);
getEntityData()->define(DATA_CONVERTING_ID, (byte) 0);
}
float Zombie::getWalkingSpeedModifier()
@@ -87,23 +87,23 @@ bool Zombie::useNewAi()
bool Zombie::isBaby()
{
return getEntityData()->getByte(DATA_BABY_ID) == (uint8_t) 1;
return getEntityData()->getByte(DATA_BABY_ID) == (byte) 1;
}
void Zombie::setBaby(bool baby)
{
getEntityData()->set(DATA_BABY_ID, (uint8_t) 1);
getEntityData()->set(DATA_BABY_ID, (byte) 1);
updateSize(isBaby());
}
bool Zombie::isVillager()
{
return getEntityData()->getByte(DATA_VILLAGER_ID) == (uint8_t) 1;
return getEntityData()->getByte(DATA_VILLAGER_ID) == (byte) 1;
}
void Zombie::setVillager(bool villager)
{
getEntityData()->set(DATA_VILLAGER_ID, (uint8_t) (villager ? 1 : 0));
getEntityData()->set(DATA_VILLAGER_ID, (byte) (villager ? 1 : 0));
}
void Zombie::aiStep()
@@ -292,7 +292,7 @@ bool Zombie::interact(shared_ptr<Player> player)
void Zombie::startConverting(int time)
{
villagerConversionTime = time;
getEntityData()->set(DATA_CONVERTING_ID, (uint8_t) 1);
getEntityData()->set(DATA_CONVERTING_ID, (byte) 1);
removeEffect(MobEffect::weakness->id);
addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0)));
@@ -300,7 +300,7 @@ void Zombie::startConverting(int time)
level->broadcastEntityEvent(shared_from_this(), EntityEvent::ZOMBIE_CONVERTING);
}
void Zombie::handleEntityEvent(uint8_t id)
void Zombie::handleEntityEvent(byte id)
{
if (id == EntityEvent::ZOMBIE_CONVERTING)
{
@@ -314,7 +314,7 @@ void Zombie::handleEntityEvent(uint8_t id)
bool Zombie::isConverting()
{
return getEntityData()->getByte(DATA_CONVERTING_ID) == (uint8_t) 1;
return getEntityData()->getByte(DATA_CONVERTING_ID) == (byte) 1;
}
void Zombie::finishConversion()
+1 -1
View File
@@ -72,7 +72,7 @@ protected:
void startConverting(int time);
public:
void handleEntityEvent(uint8_t id);
void handleEntityEvent(byte id);
bool isConverting();
protected:
@@ -24,7 +24,7 @@ void SynchedEntityData::define(int id, int value)
m_isEmpty = false;
}
void SynchedEntityData::define(int id, uint8_t value)
void SynchedEntityData::define(int id, byte value)
{
MemSect(17);
checkId(id);
@@ -82,7 +82,7 @@ void SynchedEntityData::checkId(int id)
#endif
}
uint8_t SynchedEntityData::getByte(int id)
byte SynchedEntityData::getByte(int id)
{
return itemsById[id]->getValue_byte();
}
@@ -133,7 +133,7 @@ void SynchedEntityData::set(int id, int value)
}
}
void SynchedEntityData::set(int id, uint8_t value)
void SynchedEntityData::set(int id, byte value)
{
shared_ptr<DataItem> dataItem = itemsById[id];
@@ -331,7 +331,7 @@ vector<shared_ptr<SynchedEntityData::DataItem> > *SynchedEntityData::unpack(Data
{
case TYPE_BYTE:
{
uint8_t dataRead = input->readByte();
byte dataRead = input->readByte();
item = shared_ptr<DataItem>( new DataItem(itemType, itemId, dataRead) );
}
break;
@@ -462,7 +462,7 @@ SynchedEntityData::DataItem::DataItem(int type, int id, int value) : type( type
this->dirty = true;
}
SynchedEntityData::DataItem::DataItem(int type, int id, uint8_t value) : type( type ), id( id )
SynchedEntityData::DataItem::DataItem(int type, int id, byte value) : type( type ), id( id )
{
this->value_byte = value;
this->dirty = true;
@@ -496,7 +496,7 @@ void SynchedEntityData::DataItem::setValue(int value)
this->value_int = value;
}
void SynchedEntityData::DataItem::setValue(uint8_t value)
void SynchedEntityData::DataItem::setValue(byte value)
{
this->value_byte = value;
}
@@ -526,7 +526,7 @@ short SynchedEntityData::DataItem::getValue_short()
return value_short;
}
uint8_t SynchedEntityData::DataItem::getValue_byte()
byte SynchedEntityData::DataItem::getValue_byte()
{
return value_byte;
}
+7 -7
View File
@@ -15,7 +15,7 @@ public:
const int id;
// 4J - there used to be one "value" type here of general type Object, just storing the different (used) varieties
// here separately for us
uint8_t value_byte;
byte value_byte;
int value_int;
short value_short;
wstring value_wstring;
@@ -24,19 +24,19 @@ public:
public:
// There was one type here that took a generic Object type, using overloading here instead
DataItem(int type, int id, uint8_t value);
DataItem(int type, int id, byte value);
DataItem(int type, int id, int value);
DataItem(int type, int id, const wstring& value);
DataItem(int type, int id, shared_ptr<ItemInstance> itemInstance);
DataItem(int type, int id, short value);
int getId();
void setValue(uint8_t value);
void setValue(byte value);
void setValue(int value);
void setValue(short value);
void setValue(const wstring& value);
void setValue(shared_ptr<ItemInstance> value);
uint8_t getValue_byte();
byte getValue_byte();
int getValue_int();
short getValue_short();
wstring getValue_wstring();
@@ -79,14 +79,14 @@ public:
// 4J - this function used to be a template, but there's only 3 varieties of use I've found so just hard-coding now, as
// the original had some automatic Class to type sort of conversion that's a real pain for us to actually do
void define(int id, uint8_t value);
void define(int id, byte value);
void define(int id, const wstring& value);
void define(int id, int value);
void define(int id, short value);
void defineNULL(int id, void *pVal);
void checkId(int id); // 4J - added to contain common code from overloaded define functions above
uint8_t getByte(int id);
byte getByte(int id);
short getShort(int id);
int getInteger(int id);
float getFloat(int id);
@@ -94,7 +94,7 @@ public:
shared_ptr<ItemInstance> getItemInstance(int id);
Pos *getPos(int id);
// 4J - using overloads rather than template here
void set(int id, uint8_t value);
void set(int id, byte value);
void set(int id, int value);
void set(int id, short value);
void set(int id, const wstring& value);
+8 -8
View File
@@ -19,7 +19,7 @@ TamableAnimal::~TamableAnimal()
void TamableAnimal::defineSynchedData()
{
Animal::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_FLAGS_ID, (byte) 0);
entityData->define(DATA_OWNERUUID_ID, L"");
}
@@ -86,7 +86,7 @@ void TamableAnimal::spawnTamingParticles(bool success)
}
}
void TamableAnimal::handleEntityEvent(uint8_t id)
void TamableAnimal::handleEntityEvent(byte id)
{
if (id == EntityEvent::TAMING_SUCCEEDED)
{
@@ -109,14 +109,14 @@ bool TamableAnimal::isTame()
void TamableAnimal::setTame(bool value)
{
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
byte current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x04));
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x04));
}
else
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x04));
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x04));
}
}
@@ -127,14 +127,14 @@ bool TamableAnimal::isSitting()
void TamableAnimal::setSitting(bool value)
{
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
byte current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x01));
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01));
}
else
{
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x01));
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01));
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ protected:
virtual void spawnTamingParticles(bool success);
public:
virtual void handleEntityEvent(uint8_t id);
virtual void handleEntityEvent(byte id);
virtual bool isTame();
virtual void setTame(bool value);
virtual bool isSitting();
+3 -3
View File
@@ -260,9 +260,9 @@ void Throwable::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"shake", (byte) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
}
void Throwable::readAdditionalSaveData(CompoundTag *tag)
@@ -10,7 +10,7 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, Fi
DWORD numberOfBytesRead = 0;
DWORD numberOfBytesWritten = 0;
uint8_t *data = new uint8_t[sourceFileEntry->getFileSize()];
byte *data = new byte[sourceFileEntry->getFileSize()];
// Read from source
sourceSave->readFile(sourceFileEntry, data, sourceFileEntry->getFileSize(), &numberOfBytesRead);
@@ -25,7 +25,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile
//the next byte of data, or -1 if the end of the file is reached.
int ConsoleSaveFileInputStream::read()
{
uint8_t byteRead = static_cast<uint8_t>(0);
byte byteRead = static_cast<byte>(0);
DWORD numberOfBytesRead;
BOOL result = m_saveFile->readFile(
@@ -243,7 +243,7 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file )
const int bufferSize = 4096;
int amountToRead = bufferSize;
uint8_t buffer[bufferSize];
byte buffer[bufferSize];
DWORD bufferDataSize = 0;
@@ -474,8 +474,8 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt
const DWORD bufferSize = 4096;
DWORD amountToRead = bufferSize;
//assert( nNumberOfBytesToWrite <= bufferSize );
static uint8_t buffer1[bufferSize];
static uint8_t buffer2[bufferSize];
static byte buffer1[bufferSize];
static byte buffer2[bufferSize];
DWORD buffer1Size = 0;
DWORD buffer2Size = 0;
@@ -666,11 +666,11 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
// On PS3, don't compress the data as we can't really afford the extra memory this requires for the output buffer. Instead we'll be writing
// directly from the save data.
StorageManager.SetSaveData(pvSaveMem,fileSize);
uint8_t *compData = (uint8_t *)pvSaveMem;
byte *compData = (byte *)pvSaveMem;
#else
// Attempt to allocate the required memory
// We do not own this, it belongs to the StorageManager
uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
byte *compData = (byte *)StorageManager.AllocateSaveData( compLength );
#ifdef __PSVITA__
// AP - make sure we always allocate just what is needed so it will only SAVE what is needed.
@@ -708,7 +708,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
compLength = compLength+8;
// Attempt to allocate the required memory
compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
compData = (byte *)StorageManager.AllocateSaveData( compLength );
}
#endif
@@ -38,7 +38,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b)
{
DWORD numberOfBytesWritten;
uint8_t value = (uint8_t) b;
byte value = (byte) b;
BOOL result = m_saveFile->writeFile(
m_file,
@@ -641,7 +641,7 @@ void ConsoleSaveFileSplit::deleteFile( FileEntry *file )
const int bufferSize = 4096;
int amountToRead = bufferSize;
uint8_t buffer[bufferSize];
byte buffer[bufferSize];
DWORD bufferDataSize = 0;
@@ -1044,8 +1044,8 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT
const DWORD bufferSize = 4096;
DWORD amountToRead = bufferSize;
//assert( nNumberOfBytesToWrite <= bufferSize );
static uint8_t buffer1[bufferSize];
static uint8_t buffer2[bufferSize];
static byte buffer1[bufferSize];
static byte buffer2[bufferSize];
DWORD buffer1Size = 0;
DWORD buffer2Size = 0;
@@ -1352,7 +1352,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
// Attempt to allocate the required memory
// We do not own this, it belongs to the StorageManager
uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
byte *compData = (byte *)StorageManager.AllocateSaveData( compLength );
// If we failed to allocate then compData will be NULL
// Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer
@@ -1379,7 +1379,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
compLength = compLength+8;
// Attempt to allocate the required memory
compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
compData = (byte *)StorageManager.AllocateSaveData( compLength );
}
if(compData != NULL)
+1 -1
View File
@@ -84,7 +84,7 @@ ssize_t ReadFile(int fd, void* buffer, size_t byteRead, DWORD* numberOfBytesRead
//the next byte of data, or -1 if the end of the file is reached.
int FileInputStream::read()
{
uint8_t byteRead = static_cast<uint8_t>(0);
byte byteRead = static_cast<byte>(0);
DWORD numberOfBytesRead;
BOOL bSuccess = ReadFile(
@@ -74,7 +74,7 @@ FileOutputStream::~FileOutputStream()
//b - the byte to be written.
void FileOutputStream::write(unsigned int b)
{
uint8_t value = (uint8_t) b;
byte value = (byte) b;
#if defined(_WIN32)
BOOL result = WriteFile(
+1 -1
View File
@@ -25,7 +25,7 @@ public:
dis->readFully(data);
}
uint8_t getId() { return TAG_Byte_Array; }
byte getId() { return TAG_Byte_Array; }
wstring toString()
{
+3 -3
View File
@@ -4,14 +4,14 @@
class ByteTag : public Tag
{
public:
uint8_t data;
byte data;
ByteTag(const wstring &name) : Tag(name) {}
ByteTag(const wstring &name, uint8_t data) : Tag(name) {this->data = data; }
ByteTag(const wstring &name, byte data) : Tag(name) {this->data = data; }
void write(DataOutput *dos) { dos->writeByte(data); }
void load(DataInput *dis) { data = dis->readByte(); }
uint8_t getId() { return TAG_Byte; }
byte getId() { return TAG_Byte; }
wstring toString()
{
static wchar_t buf[32];
+6 -6
View File
@@ -55,7 +55,7 @@ public:
return ret;
}
uint8_t getId()
byte getId()
{
return TAG_Compound;
}
@@ -65,7 +65,7 @@ public:
tags[name] = tag->setName(wstring( name ));
}
void putByte(const wchar_t * name, uint8_t value)
void putByte(const wchar_t * name, byte value)
{
tags[name] = (new ByteTag(name,value));
}
@@ -117,7 +117,7 @@ public:
void putBoolean(const wchar_t * string, bool val)
{
putByte(string, val?static_cast<uint8_t>(1):static_cast<uint8_t>(0));
putByte(string, val?static_cast<byte>(1):static_cast<byte>(0));
}
Tag *get(const wchar_t *name)
@@ -132,9 +132,9 @@ public:
return tags.find(name) != tags.end();
}
uint8_t getByte(const wchar_t * name)
byte getByte(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (uint8_t)0;
if (tags.find(name) == tags.end()) return (byte)0;
return ((ByteTag *) tags[name])->data;
}
@@ -200,7 +200,7 @@ public:
bool getBoolean(const wchar_t *string)
{
return getByte(string) != static_cast<uint8_t>(0);
return getByte(string) != static_cast<byte>(0);
}
void remove(const wstring &name)
+1 -1
View File
@@ -12,7 +12,7 @@ public:
void write(DataOutput *dos) { dos->writeDouble(data); }
void load(DataInput *dis) { data = dis->readDouble(); }
uint8_t getId() { return TAG_Double; }
byte getId() { return TAG_Double; }
wstring toString()
{
static wchar_t buf[32];

Some files were not shown because too many files have changed in this diff Show More