mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
chore: fmt
This commit is contained in:
parent
73392fa06a
commit
aff677a995
|
|
@ -26,13 +26,9 @@ void Chunk::CreateNewThreadStorage() {
|
||||||
m_tlsTileIds = new unsigned char[16 * 16 * Level::maxBuildHeight];
|
m_tlsTileIds = new unsigned char[16 * 16 * Level::maxBuildHeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chunk::ReleaseThreadStorage() {
|
void Chunk::ReleaseThreadStorage() { delete m_tlsTileIds; }
|
||||||
delete m_tlsTileIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t* Chunk::GetTileIdsStorage() {
|
uint8_t* Chunk::GetTileIdsStorage() { return m_tlsTileIds; }
|
||||||
return m_tlsTileIds;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
// 4J Stu - Don't want this when multi-threaded
|
// 4J Stu - Don't want this when multi-threaded
|
||||||
Tesselator* Chunk::t = Tesselator::getInstance();
|
Tesselator* Chunk::t = Tesselator::getInstance();
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,7 @@ int normal;
|
||||||
*/
|
*/
|
||||||
thread_local Tesselator* Tesselator::m_tlsInstance = nullptr;
|
thread_local Tesselator* Tesselator::m_tlsInstance = nullptr;
|
||||||
|
|
||||||
Tesselator* Tesselator::getInstance() {
|
Tesselator* Tesselator::getInstance() { return m_tlsInstance; }
|
||||||
return m_tlsInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tesselator::CreateNewThreadStorage(int bytes) {
|
void Tesselator::CreateNewThreadStorage(int bytes) {
|
||||||
Tesselator::m_tlsInstance = new Tesselator(bytes / 4);
|
Tesselator::m_tlsInstance = new Tesselator(bytes / 4);
|
||||||
|
|
@ -349,7 +347,7 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) {
|
||||||
// where: cccc is a 15-bit (5 bits per x/y/z) origin position / offset
|
// where: cccc is a 15-bit (5 bits per x/y/z) origin position / offset
|
||||||
// for the whole quad. Each
|
// for the whole quad. Each
|
||||||
// component is unsigned, and offset by 16
|
// component is unsigned, and offset by 16
|
||||||
//so has a range 0 to 31 actually representing -16 to 15
|
// so has a range 0 to 31 actually representing -16 to 15
|
||||||
// xx,yy,zz are 8-bit deltas from this origin to each vertex. These are
|
// xx,yy,zz are 8-bit deltas from this origin to each vertex. These are
|
||||||
// unsigned 1.7 fixed point, ie
|
// unsigned 1.7 fixed point, ie
|
||||||
// representing a range of 0 to 1.9921875
|
// representing a range of 0 to 1.9921875
|
||||||
|
|
@ -358,14 +356,16 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) {
|
||||||
// v required by the quad ud,vd are 8-bit unsigned fixed pont
|
// v required by the quad ud,vd are 8-bit unsigned fixed pont
|
||||||
// UV deltas, which can be added to umin/vmin to get umax, vmax
|
// UV deltas, which can be added to umin/vmin to get umax, vmax
|
||||||
// and therefore define the 4 corners of
|
// and therefore define the 4 corners of
|
||||||
//an axis aligned UV mapping
|
// an axis aligned UV mapping
|
||||||
// i is a code per vertex that indicates which of umin/umax
|
// i is a code per vertex that indicates which of umin/umax
|
||||||
// should be used for u, and which
|
// should be used for u, and which
|
||||||
// of vmin/vmax should be used for v for
|
// of vmin/vmax should be used for v for
|
||||||
//this vertex. The coding is: 0 - u = umin, v = vmin 1 - u = umin, v = vmax 2 -
|
// this vertex. The coding is: 0 - u =
|
||||||
//u = umax, v = vmin 3 - u = umax, v = vmax 4 - not axis aligned, use uv stored
|
// umin, v = vmin 1 - u = umin, v
|
||||||
//in the vertex data 4 on from this one ll is an 8-bit (4 bit per
|
// = vmax 2 - u = umax, v = vmin
|
||||||
//u/v) index into the current lighting texture
|
// 3 - u = umax, v = vmax 4 - not
|
||||||
|
// axis aligned, use uv stored in the vertex data 4 on from this one ll
|
||||||
|
// is an 8-bit (4 bit per u/v) index into the current lighting texture
|
||||||
//
|
//
|
||||||
// For quads that don't have axis aligned UVs (ie have a code for 4 in i as
|
// For quads that don't have axis aligned UVs (ie have a code for 4 in i as
|
||||||
// described above) the 8 byte vertex is followed by a further 8 bytes which
|
// described above) the 8 byte vertex is followed by a further 8 bytes which
|
||||||
|
|
@ -747,7 +747,8 @@ void packLinuxLightmapCoords(int tex2, std::int16_t& u, std::int16_t& v) {
|
||||||
v = static_cast<std::int16_t>((tex2 >> 16) & 0xffff);
|
v = static_cast<std::int16_t>((tex2 >> 16) & 0xffff);
|
||||||
|
|
||||||
// Linux 4jlibs consumes packed UV2 values by dividing them by 256 directly
|
// Linux 4jlibs consumes packed UV2 values by dividing them by 256 directly
|
||||||
// for chunk and other non-scaleLight draws, so offset to texel centers here.
|
// for chunk and other non-scaleLight draws, so offset to texel centers
|
||||||
|
// here.
|
||||||
u += 8;
|
u += 8;
|
||||||
v += 8;
|
v += 8;
|
||||||
}
|
}
|
||||||
|
|
@ -853,8 +854,7 @@ void Tesselator::vertex(float x, float y, float z) {
|
||||||
pShortData[4] = (((int)(uu * 8192.0f)) & 0xffff);
|
pShortData[4] = (((int)(uu * 8192.0f)) & 0xffff);
|
||||||
pShortData[5] = (((int)(v * 8192.0f)) & 0xffff);
|
pShortData[5] = (((int)(v * 8192.0f)) & 0xffff);
|
||||||
std::int16_t u2 = static_cast<std::int16_t>(_tex2 & 0xffff);
|
std::int16_t u2 = static_cast<std::int16_t>(_tex2 & 0xffff);
|
||||||
std::int16_t v2 =
|
std::int16_t v2 = static_cast<std::int16_t>((_tex2 >> 16) & 0xffff);
|
||||||
static_cast<std::int16_t>((_tex2 >> 16) & 0xffff);
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
packLinuxLightmapCoords(_tex2, u2, v2);
|
packLinuxLightmapCoords(_tex2, u2, v2);
|
||||||
logLinuxPackedLightmapCoords("compact", _tex2, u2, v2);
|
logLinuxPackedLightmapCoords("compact", _tex2, u2, v2);
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,9 @@ thread_local bool PistonBaseTile::m_tlsIgnoreUpdate = false;
|
||||||
// leaving the piston in a bad (simultaneously extended & not extended) state.
|
// leaving the piston in a bad (simultaneously extended & not extended) state.
|
||||||
// 4J - ignoreUpdate is a static in java, implementing as TLS here to make
|
// 4J - ignoreUpdate is a static in java, implementing as TLS here to make
|
||||||
// thread safe
|
// thread safe
|
||||||
bool PistonBaseTile::ignoreUpdate() {
|
bool PistonBaseTile::ignoreUpdate() { return m_tlsIgnoreUpdate; }
|
||||||
return m_tlsIgnoreUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PistonBaseTile::ignoreUpdate(bool set) {
|
void PistonBaseTile::ignoreUpdate(bool set) { m_tlsIgnoreUpdate = set; }
|
||||||
m_tlsIgnoreUpdate = set;
|
|
||||||
}
|
|
||||||
|
|
||||||
PistonBaseTile::PistonBaseTile(int id, bool isSticky)
|
PistonBaseTile::PistonBaseTile(int id, bool isSticky)
|
||||||
: Tile(id, Material::piston, false) {
|
: Tile(id, Material::piston, false) {
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,9 @@ thread_local bool TheEndPortal::m_tlsAllowAnywhere = false;
|
||||||
|
|
||||||
// 4J - allowAnywhere is a static in java, implementing as TLS here to make
|
// 4J - allowAnywhere is a static in java, implementing as TLS here to make
|
||||||
// thread safe
|
// thread safe
|
||||||
bool TheEndPortal::allowAnywhere() {
|
bool TheEndPortal::allowAnywhere() { return m_tlsAllowAnywhere; }
|
||||||
return m_tlsAllowAnywhere;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TheEndPortal::allowAnywhere(bool set) {
|
void TheEndPortal::allowAnywhere(bool set) { m_tlsAllowAnywhere = set; }
|
||||||
m_tlsAllowAnywhere = set;
|
|
||||||
}
|
|
||||||
|
|
||||||
TheEndPortal::TheEndPortal(int id, Material* material)
|
TheEndPortal::TheEndPortal(int id, Material* material)
|
||||||
: BaseEntityTile(id, material, false) {
|
: BaseEntityTile(id, material, false) {
|
||||||
|
|
|
||||||
|
|
@ -229,13 +229,9 @@ Tile::ThreadStorage::ThreadStorage() {
|
||||||
tileId = 0;
|
tileId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tile::CreateNewThreadStorage() {
|
void Tile::CreateNewThreadStorage() { m_tlsShape = new ThreadStorage(); }
|
||||||
m_tlsShape = new ThreadStorage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tile::ReleaseThreadStorage() {
|
void Tile::ReleaseThreadStorage() { delete m_tlsShape; }
|
||||||
delete m_tlsShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tile::staticCtor() {
|
void Tile::staticCtor() {
|
||||||
Tile::SOUND_NORMAL = new Tile::SoundType(eMaterialSoundType_STONE, 1, 1);
|
Tile::SOUND_NORMAL = new Tile::SoundType(eMaterialSoundType_STONE, 1, 1);
|
||||||
|
|
@ -1918,8 +1914,7 @@ bool Tile::isFaceVisible(Level* level, int x, int y, int z, int f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tile::shouldRenderFace(LevelSource* level, int x, int y, int z, int face) {
|
bool Tile::shouldRenderFace(LevelSource* level, int x, int y, int z, int face) {
|
||||||
ThreadStorage* tls =
|
ThreadStorage* tls = m_tlsShape;
|
||||||
m_tlsShape;
|
|
||||||
// 4J Stu - Added this so that the TLS shape is correct for this tile
|
// 4J Stu - Added this so that the TLS shape is correct for this tile
|
||||||
if (tls->tileId != this->id) updateDefaultShape();
|
if (tls->tileId != this->id) updateDefaultShape();
|
||||||
if (face == 0 && tls->yy0 > 0) return true;
|
if (face == 0 && tls->yy0 > 0) return true;
|
||||||
|
|
@ -2595,7 +2590,8 @@ int Tile::SoundType::getPlaceSound() const { return iPlaceSound; }
|
||||||
4J: These are necessary on the PS3.
|
4J: These are necessary on the PS3.
|
||||||
(and 4 and Vita).
|
(and 4 and Vita).
|
||||||
*/
|
*/
|
||||||
#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined __linux__)
|
#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || \
|
||||||
|
defined __linux__)
|
||||||
const int Tile::stone_Id;
|
const int Tile::stone_Id;
|
||||||
const int Tile::grass_Id;
|
const int Tile::grass_Id;
|
||||||
const int Tile::dirt_Id;
|
const int Tile::dirt_Id;
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@
|
||||||
const int TopSnowTile::MAX_HEIGHT = 6;
|
const int TopSnowTile::MAX_HEIGHT = 6;
|
||||||
const int TopSnowTile::HEIGHT_MASK = 7; // max 8 steps
|
const int TopSnowTile::HEIGHT_MASK = 7; // max 8 steps
|
||||||
|
|
||||||
TopSnowTile::TopSnowTile(int id)
|
TopSnowTile::TopSnowTile(int id) : Tile(id, Material::topSnow, false) {
|
||||||
: Tile(id, Material::topSnow, false) {
|
|
||||||
setShape(0, 0, 0, 1, 2 / 16.0f, 1);
|
setShape(0, 0, 0, 1, 2 / 16.0f, 1);
|
||||||
setTicking(true);
|
setTicking(true);
|
||||||
updateShape(0);
|
updateShape(0);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
#include "../Headers/net.minecraft.world.phys.h"
|
#include "../Headers/net.minecraft.world.phys.h"
|
||||||
#include "TripWireTile.h"
|
#include "TripWireTile.h"
|
||||||
|
|
||||||
TripWireTile::TripWireTile(int id)
|
TripWireTile::TripWireTile(int id) : Tile(id, Material::decoration, false) {
|
||||||
: Tile(id, Material::decoration, false) {
|
|
||||||
setShape(0, 0, 0, 1, 2.5f / 16.0f, 1);
|
setShape(0, 0, 0, 1, 2.5f / 16.0f, 1);
|
||||||
this->setTicking(true);
|
this->setTicking(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,9 +102,7 @@ void Level::enableLightingCache() {
|
||||||
256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES);
|
256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::destroyLightingCache() {
|
void Level::destroyLightingCache() { delete m_tlsLightCache; }
|
||||||
delete m_tlsLightCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int GetIndex(int x, int y, int z) {
|
inline int GetIndex(int x, int y, int z) {
|
||||||
return ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
return ((x & 15) << 8) | ((y & 15) << 4) | (z & 15);
|
||||||
|
|
@ -491,13 +489,9 @@ void Level::flushCache(lightCache_t* cache, uint64_t cacheUse,
|
||||||
|
|
||||||
// 4J - added following 2 functions to move instaBuild flag from being a class
|
// 4J - added following 2 functions to move instaBuild flag from being a class
|
||||||
// member, to TLS
|
// member, to TLS
|
||||||
bool Level::getInstaTick() {
|
bool Level::getInstaTick() { return m_tlsInstaTick; }
|
||||||
return m_tlsInstaTick;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Level::setInstaTick(bool enable) {
|
void Level::setInstaTick(bool enable) { m_tlsInstaTick = enable; }
|
||||||
m_tlsInstaTick = enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4J - added
|
// 4J - added
|
||||||
bool Level::hasEntitiesToRemove() { return !entitiesToRemove.empty(); }
|
bool Level::hasEntitiesToRemove() { return !entitiesToRemove.empty(); }
|
||||||
|
|
@ -1569,8 +1563,8 @@ void Level::playStreamingMusic(const std::wstring& name, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::playMusic(double x, double y, double z,
|
void Level::playMusic(double x, double y, double z, const std::wstring& string,
|
||||||
const std::wstring& string, float volume) {}
|
float volume) {}
|
||||||
|
|
||||||
// 4J removed -
|
// 4J removed -
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -332,8 +332,8 @@ public:
|
||||||
float fClipSoundDist = 16.0f);
|
float fClipSoundDist = 16.0f);
|
||||||
|
|
||||||
void playStreamingMusic(const std::wstring& name, int x, int y, int z);
|
void playStreamingMusic(const std::wstring& name, int x, int y, int z);
|
||||||
void playMusic(double x, double y, double z,
|
void playMusic(double x, double y, double z, const std::wstring& string,
|
||||||
const std::wstring& string, float volume);
|
float volume);
|
||||||
// 4J removed - void addParticle(const std::wstring& id, double x, double y,
|
// 4J removed - void addParticle(const std::wstring& id, double x, double y,
|
||||||
// double z, double xd, double yd, double zd);
|
// double z, double xd, double yd, double zd);
|
||||||
void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd,
|
void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd,
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ FireworksRecipe::ThreadStorage::ThreadStorage() { resultItem = nullptr; }
|
||||||
|
|
||||||
void FireworksRecipe::CreateNewThreadStorage() {
|
void FireworksRecipe::CreateNewThreadStorage() {
|
||||||
ThreadStorage* tls = new ThreadStorage();
|
ThreadStorage* tls = new ThreadStorage();
|
||||||
|
|
||||||
if (m_defaultThreadStorage == nullptr) {
|
if (m_defaultThreadStorage == nullptr) {
|
||||||
m_defaultThreadStorage = tls;
|
m_defaultThreadStorage = tls;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_tlsStorage = tls;
|
m_tlsStorage = tls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,8 @@ public:
|
||||||
virtual const int getGroup() { return 0; }
|
virtual const int getGroup() { return 0; }
|
||||||
|
|
||||||
// 4J-PB
|
// 4J-PB
|
||||||
virtual bool
|
virtual bool requiresRecipe(int iRecipe) { return false; };
|
||||||
requiresRecipe(int iRecipe)
|
virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {};
|
||||||
{
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
virtual void
|
|
||||||
collectRequirements(INGREDIENTS_REQUIRED* pIngReq)
|
|
||||||
{};
|
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
static void updatePossibleRecipes(
|
static void updatePossibleRecipes(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue