Huge skylight optimizations. Also fixed the submodules.

This commit is contained in:
milkwx3
2026-07-04 01:48:50 +03:00
parent 85ddc90883
commit 7ab2d5a083
7 changed files with 81 additions and 52 deletions
+7 -7
View File
@@ -40,7 +40,7 @@ void DrawItem(InventoryItem item, int x, int y) {
if(item.item->type == IType_Block) {
atlas = terrain;
atl_size = ATLAS_SIZE_W;
tex = BLOCKS[item.damage].textureTop;
tex = GetBlockDefinition(item.damage).textureTop;
}
DrawTexturePro(atlas,
{
@@ -198,9 +198,9 @@ static bool GetTaggedItem(std::string tag, InventoryItem* item) {
bool isBlock;
bool found;
for(int blk = 0; blk < MAX_BLOCK_ID; blk++) {
if(IDTagMatch(tag, BLOCKS[blk].name)) {
if(IDTagMatch(tag, GetBlockDefinition(blk).name)) {
isBlock = true;
id = GetNumericIDFromString(BLOCKS[blk].name);
id = GetNumericIDFromString(GetBlockDefinition(blk).name);
found = true;
break;
};
@@ -307,7 +307,7 @@ void DrawHotbar() {
if(item.item != nullptr) {
bool blockCond = item.item->type == IType_Block && ingredient.type == IType_Block && item.damage == GetNumericIDFromString(ingredient.id);
bool genericCond = item.item->type != IType_Block && ingredient.type == IType_Generic && item.item->id == ingredient.id;
bool tagBlockCond = item.item->type == IType_Block && ingredient.type == IType_Special_Tag && IDTagMatch(ingredient.id, BLOCKS[item.damage].name);
bool tagBlockCond = item.item->type == IType_Block && ingredient.type == IType_Special_Tag && IDTagMatch(ingredient.id, GetBlockDefinition(item.damage).name);
bool tagItemCond = item.item->type != IType_Block && ingredient.type == IType_Special_Tag && IDTagMatch(ingredient.id, item.item->id);
if(blockCond || genericCond || tagBlockCond || tagItemCond) {
items.push_back(i);
@@ -366,7 +366,7 @@ void DrawHotbar() {
if(item.item != nullptr) {
bool blockCond = item.item->type == IType_Block && ingredient.type == IType_Block && item.damage == GetNumericIDFromString(ingredient.id);
bool genericCond = item.item->type != IType_Block && ingredient.type == IType_Generic && item.item->id == ingredient.id;
bool tagBlockCond = item.item->type == IType_Block && ingredient.type == IType_Special_Tag && IDTagMatch(ingredient.id, BLOCKS[item.damage].name);
bool tagBlockCond = item.item->type == IType_Block && ingredient.type == IType_Special_Tag && IDTagMatch(ingredient.id, GetBlockDefinition(item.damage).name);
bool tagItemCond = item.item->type != IType_Block && ingredient.type == IType_Special_Tag && IDTagMatch(ingredient.id, item.item->id);
if(blockCond || genericCond || tagBlockCond || tagItemCond) {
items[i] = ingredient.quantity;
@@ -432,7 +432,7 @@ void DrawHotbar() {
DrawItem(*movingItem, GetMouseX(), GetMouseY());
std::string name = "item."+movingItem->item->id;
if(movingItem->item->type == IType_Block) {
name = "item."+BLOCKS[movingItem->damage].name;
name = "item."+GetBlockDefinition(movingItem->damage).name;
}
DrawTextB(LocaleGet(name).c_str(), GetMouseX()-16, GetMouseY()+56, 16, WHITE);
}
@@ -461,7 +461,7 @@ void DrawSelectedItem() {
DrawCubeTexture(playerTex, {0, -12*PIXUNIT/2, 0}, 4*PIXUNIT, 12*PIXUNIT, 4*PIXUNIT, WHITE, 44,20,4,4);
if(item.item != nullptr) {
if(item.item->type == IType_Block) {
DrawCubeBlock(terrain, {0, -12*PIXUNIT - 0.25f, 0}, 0.5f, 0.5f, 0.5f, BLOCKS[item.damage]);
DrawCubeBlock(terrain, {0, -12*PIXUNIT - 0.25f, 0}, 0.5f, 0.5f, 0.5f, GetBlockDefinition(item.damage));
}
else {
UVCorners left = GetUVTex(item.item->texture);