Change block Fullbright boolean property to Brightness uint8 property

This commit is contained in:
Goodlyay 2023-04-23 05:32:07 -07:00
parent f771a917d8
commit 054cceed87
10 changed files with 103 additions and 92 deletions

View File

@ -7,6 +7,7 @@
#include "Inventory.h" #include "Inventory.h"
#include "Event.h" #include "Event.h"
#include "Picking.h" #include "Picking.h"
#include "Lighting.h"
struct _BlockLists Blocks; struct _BlockLists Blocks;
@ -22,11 +23,16 @@ const char* const Sound_Names[SOUND_COUNT] = {
#define FOG_WATER PackedCol_Make( 5, 5, 51, 255) #define FOG_WATER PackedCol_Make( 5, 5, 51, 255)
#define FOG_LAVA PackedCol_Make(153, 25, 0, 255) #define FOG_LAVA PackedCol_Make(153, 25, 0, 255)
/* Brightness */
#define BRIT_NONE 0
#define BRIT_FULL MODERN_LIGHTING_MAX_LEVEL
#define BRIT_MAGM 1
struct SimpleBlockDef { struct SimpleBlockDef {
const char* name; const char* name;
cc_uint8 topTexture, sideTexture, bottomTexture, height; cc_uint8 topTexture, sideTexture, bottomTexture, height;
PackedCol fogColor; cc_uint8 fogDensity; PackedCol fogColor; cc_uint8 fogDensity;
cc_bool fullBright, blocksLight; cc_uint8 gravity; cc_uint8 brightness, blocksLight; cc_uint8 gravity;
cc_uint8 draw, collide, digSound, stepSound; cc_uint8 draw, collide, digSound, stepSound;
}; };
static const struct SimpleBlockDef invalid_blockDef = { static const struct SimpleBlockDef invalid_blockDef = {
@ -35,82 +41,82 @@ static const struct SimpleBlockDef invalid_blockDef = {
/* Properties for all built-in blocks (Classic and CPE blocks) */ /* Properties for all built-in blocks (Classic and CPE blocks) */
static const struct SimpleBlockDef core_blockDefs[] = { static const struct SimpleBlockDef core_blockDefs[] = {
/*NAME TOP SID BOT HEI FOG_COLOR DENS FULL BLOCKS GRAV DRAW_MODE COLLIDE_MODE DIG_SOUND STEP_SOUND */ /*NAME TOP SID BOT HEI FOG_COLOR DENS BRIT BLOCKS GRAV DRAW_MODE COLLIDE_MODE DIG_SOUND STEP_SOUND */
{ "Air", 0, 0, 0, 16, FOG_NONE , 0, false, false, 100, DRAW_GAS, COLLIDE_NONE, SOUND_NONE, SOUND_NONE }, { "Air", 0, 0, 0, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_GAS, COLLIDE_NONE, SOUND_NONE, SOUND_NONE },
{ "Stone", 1, 1, 1, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Stone", 1, 1, 1, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Grass", 0, 3, 2, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS }, { "Grass", 0, 3, 2, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS },
{ "Dirt", 2, 2, 2, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRAVEL, SOUND_GRAVEL }, { "Dirt", 2, 2, 2, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRAVEL, SOUND_GRAVEL },
{ "Cobblestone", 16, 16, 16, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Cobblestone", 16, 16, 16, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Wood", 4, 4, 4, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD }, { "Wood", 4, 4, 4, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD },
{ "Sapling", 15, 15, 15, 16, FOG_NONE , 0, false, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE }, { "Sapling", 15, 15, 15, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE },
{ "Bedrock", 17, 17, 17, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Bedrock", 17, 17, 17, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Water", 14, 14, 14, 16, FOG_WATER, 10, false, true, 100, DRAW_TRANSLUCENT, COLLIDE_WATER, SOUND_NONE, SOUND_NONE }, { "Water", 14, 14, 14, 16, FOG_WATER, 10, BRIT_NONE, true, 100, DRAW_TRANSLUCENT, COLLIDE_WATER, SOUND_NONE, SOUND_NONE },
{ "Still water", 14, 14, 14, 16, FOG_WATER, 10, false, true, 100, DRAW_TRANSLUCENT, COLLIDE_WATER, SOUND_NONE, SOUND_NONE }, { "Still water", 14, 14, 14, 16, FOG_WATER, 10, BRIT_NONE, true, 100, DRAW_TRANSLUCENT, COLLIDE_WATER, SOUND_NONE, SOUND_NONE },
{ "Lava", 30, 30, 30, 16, FOG_LAVA , 180, true, true, 100, DRAW_OPAQUE, COLLIDE_LAVA, SOUND_NONE, SOUND_NONE }, { "Lava", 30, 30, 30, 16, FOG_LAVA , 180, BRIT_FULL, true, 100, DRAW_OPAQUE, COLLIDE_LAVA, SOUND_NONE, SOUND_NONE },
{ "Still lava", 30, 30, 30, 16, FOG_LAVA , 180, true, true, 100, DRAW_OPAQUE, COLLIDE_LAVA, SOUND_NONE, SOUND_NONE }, { "Still lava", 30, 30, 30, 16, FOG_LAVA , 180, BRIT_FULL, true, 100, DRAW_OPAQUE, COLLIDE_LAVA, SOUND_NONE, SOUND_NONE },
{ "Sand", 18, 18, 18, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_SAND, SOUND_SAND }, { "Sand", 18, 18, 18, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_SAND, SOUND_SAND },
{ "Gravel", 19, 19, 19, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRAVEL, SOUND_GRAVEL }, { "Gravel", 19, 19, 19, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRAVEL, SOUND_GRAVEL },
{ "Gold ore", 32, 32, 32, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Gold ore", 32, 32, 32, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Iron ore", 33, 33, 33, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Iron ore", 33, 33, 33, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Coal ore", 34, 34, 34, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Coal ore", 34, 34, 34, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Log", 21, 20, 21, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD }, { "Log", 21, 20, 21, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD },
{ "Leaves", 22, 22, 22, 16, FOG_NONE , 0, false, false, 40, DRAW_TRANSPARENT_THICK, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS }, { "Leaves", 22, 22, 22, 16, FOG_NONE , 0, BRIT_NONE, false, 40, DRAW_TRANSPARENT_THICK, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS },
{ "Sponge", 48, 48, 48, 16, FOG_NONE , 0, false, true, 90, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS }, { "Sponge", 48, 48, 48, 16, FOG_NONE , 0, BRIT_NONE, true, 90, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS },
{ "Glass", 49, 49, 49, 16, FOG_NONE , 0, false, false, 100, DRAW_TRANSPARENT, COLLIDE_SOLID, SOUND_GLASS,SOUND_STONE}, { "Glass", 49, 49, 49, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_TRANSPARENT, COLLIDE_SOLID, SOUND_GLASS,SOUND_STONE},
{ "Red", 64, 64, 64, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Red", 64, 64, 64, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Orange", 65, 65, 65, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Orange", 65, 65, 65, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Yellow", 66, 66, 66, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Yellow", 66, 66, 66, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Lime", 67, 67, 67, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Lime", 67, 67, 67, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Green", 68, 68, 68, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Green", 68, 68, 68, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Teal", 69, 69, 69, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Teal", 69, 69, 69, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Aqua", 70, 70, 70, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Aqua", 70, 70, 70, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Cyan", 71, 71, 71, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Cyan", 71, 71, 71, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Blue", 72, 72, 72, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Blue", 72, 72, 72, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Indigo", 73, 73, 73, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Indigo", 73, 73, 73, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Violet", 74, 74, 74, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Violet", 74, 74, 74, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Magenta", 75, 75, 75, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Magenta", 75, 75, 75, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Pink", 76, 76, 76, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Pink", 76, 76, 76, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Black", 77, 77, 77, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Black", 77, 77, 77, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Gray", 78, 78, 78, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Gray", 78, 78, 78, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "White", 79, 79, 79, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "White", 79, 79, 79, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Dandelion", 13, 13, 13, 16, FOG_NONE , 0, false, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE }, { "Dandelion", 13, 13, 13, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE },
{ "Rose", 12, 12, 12, 16, FOG_NONE , 0, false, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE }, { "Rose", 12, 12, 12, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE },
{ "Brown mushroom", 29, 29, 29, 16, FOG_NONE , 0, false, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE }, { "Brown mushroom", 29, 29, 29, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE },
{ "Red mushroom", 28, 28, 28, 16, FOG_NONE , 0, false, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE }, { "Red mushroom", 28, 28, 28, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_GRASS, SOUND_NONE },
{ "Gold", 24, 40, 56, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_METAL, SOUND_METAL }, { "Gold", 24, 40, 56, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_METAL, SOUND_METAL },
{ "Iron", 23, 39, 55, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_METAL, SOUND_METAL }, { "Iron", 23, 39, 55, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_METAL, SOUND_METAL },
{ "Double slab", 6, 5, 6, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Double slab", 6, 5, 6, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Slab", 6, 5, 6, 8, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Slab", 6, 5, 6, 8, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Brick", 7, 7, 7, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Brick", 7, 7, 7, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "TNT", 9, 8, 10, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS }, { "TNT", 9, 8, 10, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_GRASS, SOUND_GRASS },
{ "Bookshelf", 4, 35, 4, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD }, { "Bookshelf", 4, 35, 4, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD },
{ "Mossy rocks", 36, 36, 36, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Mossy rocks", 36, 36, 36, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Obsidian", 37, 37, 37, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Obsidian", 37, 37, 37, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Cobblestone slab", 16, 16, 16, 8, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Cobblestone slab", 16, 16, 16, 8, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Rope", 11, 11, 11, 16, FOG_NONE , 0, false, false, 100, DRAW_SPRITE, COLLIDE_CLIMB, SOUND_CLOTH, SOUND_CLOTH }, { "Rope", 11, 11, 11, 16, FOG_NONE , 0, BRIT_NONE, false, 100, DRAW_SPRITE, COLLIDE_CLIMB, SOUND_CLOTH, SOUND_CLOTH },
{ "Sandstone", 25, 41, 57, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Sandstone", 25, 41, 57, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Snow", 50, 50, 50, 4, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_NONE, SOUND_SNOW, SOUND_SNOW }, { "Snow", 50, 50, 50, 4, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_NONE, SOUND_SNOW, SOUND_SNOW },
{ "Fire", 38, 38, 38, 16, FOG_NONE , 0, true, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_WOOD, SOUND_NONE }, { "Fire", 38, 38, 38, 16, FOG_NONE , 0, BRIT_FULL, false, 100, DRAW_SPRITE, COLLIDE_NONE, SOUND_WOOD, SOUND_NONE },
{ "Light pink", 80, 80, 80, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Light pink", 80, 80, 80, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Forest green", 81, 81, 81, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Forest green", 81, 81, 81, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Brown", 82, 82, 82, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Brown", 82, 82, 82, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Deep blue", 83, 83, 83, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Deep blue", 83, 83, 83, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Turquoise", 84, 84, 84, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH }, { "Turquoise", 84, 84, 84, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_CLOTH, SOUND_CLOTH },
{ "Ice", 51, 51, 51, 16, FOG_NONE , 0, false, true, 100, DRAW_TRANSLUCENT, COLLIDE_ICE, SOUND_STONE, SOUND_STONE }, { "Ice", 51, 51, 51, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_TRANSLUCENT, COLLIDE_ICE, SOUND_STONE, SOUND_STONE },
{ "Ceramic tile", 54, 54, 54, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Ceramic tile", 54, 54, 54, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Magma", 86, 86, 86, 16, FOG_NONE , 0, true, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Magma", 86, 86, 86, 16, FOG_NONE , 0, BRIT_MAGM, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Pillar", 26, 42, 58, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }, { "Pillar", 26, 42, 58, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE },
{ "Crate", 53, 53, 53, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD }, { "Crate", 53, 53, 53, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_WOOD, SOUND_WOOD },
{ "Stone brick", 52, 52, 52, 16, FOG_NONE , 0, false, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE } { "Stone brick", 52, 52, 52, 16, FOG_NONE , 0, BRIT_NONE, true, 100, DRAW_OPAQUE, COLLIDE_SOLID, SOUND_STONE, SOUND_STONE }
/*NAME TOP SID BOT HEI FOG_COLOR DENS FULL BLOCKS GRAV DRAW_MODE COLLIDE_MODE DIG_SOUND STEP_SOUND */ /*NAME TOP SID BOT HEI FOG_COLOR DENS BRIT BLOCKS GRAV DRAW_MODE COLLIDE_MODE DIG_SOUND STEP_SOUND */
}; };
/* Returns a backwards compatible collide type of a block */ /* Returns a backwards compatible collide type of a block */
@ -462,7 +468,7 @@ void Block_ResetProps(BlockID block) {
const cc_string name = String_FromReadonly(def->name); const cc_string name = String_FromReadonly(def->name);
Blocks.BlocksLight[block] = def->blocksLight; Blocks.BlocksLight[block] = def->blocksLight;
Blocks.FullBright[block] = def->fullBright; Blocks.Brightness[block] = def->brightness;
Blocks.FogCol[block] = def->fogColor; Blocks.FogCol[block] = def->fogColor;
Blocks.FogDensity[block] = def->fogDensity / 100.0f; Blocks.FogDensity[block] = def->fogDensity / 100.0f;
Block_SetCollide(block, def->collide); Block_SetCollide(block, def->collide);
@ -518,6 +524,10 @@ int Block_Parse(const cc_string* name) {
return Block_FindID(name); return Block_FindID(name);
} }
cc_uint8 Block_ReadBrightness(cc_uint8 fullBright) {
//TODO, then use in Formats.c and Protocol.c
return 0;
}
/*########################################################################################################################* /*########################################################################################################################*
*-------------------------------------------------------AutoRotate--------------------------------------------------------* *-------------------------------------------------------AutoRotate--------------------------------------------------------*

View File

@ -46,7 +46,7 @@ CC_VAR extern struct _BlockLists {
/* Whether this block prevents lights from passing through it. */ /* Whether this block prevents lights from passing through it. */
cc_bool BlocksLight[BLOCK_COUNT]; cc_bool BlocksLight[BLOCK_COUNT];
/* Whether this block is fully bright/light emitting. (Like lava) */ /* Whether this block is fully bright/light emitting. (Like lava) */
cc_bool FullBright[BLOCK_COUNT]; cc_uint8 Brightness[BLOCK_COUNT];
/* Fog colour when player is inside this block. */ /* Fog colour when player is inside this block. */
/* NOTE: Only applies if fog density is not 0. */ /* NOTE: Only applies if fog density is not 0. */
PackedCol FogCol[BLOCK_COUNT]; PackedCol FogCol[BLOCK_COUNT];
@ -112,6 +112,7 @@ if (Blocks.Tinted[block]) col = PackedCol_Tint(col, Blocks.FogCol[block]);
/* The difference can be seen by placing a lower and upper slab block on a wall, */ /* The difference can be seen by placing a lower and upper slab block on a wall, */
/* and comparing whether the block directly behind them is in shadow or not */ /* and comparing whether the block directly behind them is in shadow or not */
#define LIGHT_FLAG_SHADES_FROM_BELOW 6 #define LIGHT_FLAG_SHADES_FROM_BELOW 6
cc_uint8 Block_ReadBrightness(cc_uint8 fullBright);
/* Returns whether the given block has been changed from default */ /* Returns whether the given block has been changed from default */
cc_bool Block_IsCustomDefined(BlockID block); cc_bool Block_IsCustomDefined(BlockID block);

View File

@ -178,7 +178,7 @@ static void PrepareChunk(int x1, int y1, int z1) {
if (Blocks.Draw[b] == DRAW_SPRITE) { AddSpriteVertices(b); continue; } if (Blocks.Draw[b] == DRAW_SPRITE) { AddSpriteVertices(b); continue; }
Builder_X = x; Builder_Y = y; Builder_Z = z; Builder_X = x; Builder_Y = y; Builder_Z = z;
Builder_FullBright = Blocks.FullBright[b]; Builder_FullBright = Blocks.Brightness[b];
tileIdx = b * BLOCK_COUNT; tileIdx = b * BLOCK_COUNT;
/* All of these function calls are inlined as they can be called tens of millions to hundreds of millions of times. */ /* All of these function calls are inlined as they can be called tens of millions to hundreds of millions of times. */
@ -499,7 +499,7 @@ static void Builder_DrawSprite(int x, int y, int z) {
if (offsetType == 7) { y1 -= valY; y2 -= valY; } if (offsetType == 7) { y1 -= valY; y2 -= valY; }
} }
bright = Blocks.FullBright[Builder_Block]; bright = Blocks.Brightness[Builder_Block];
part = &Builder_Parts[Atlas1D_Index(loc)]; part = &Builder_Parts[Atlas1D_Index(loc)];
v.Col = bright ? PACKEDCOL_WHITE : Lighting.Color_Fast(x, y, z); v.Col = bright ? PACKEDCOL_WHITE : Lighting.Color_Fast(x, y, z);
Block_Tint(v.Col, Builder_Block); Block_Tint(v.Col, Builder_Block);
@ -655,7 +655,7 @@ static void NormalBuilder_RenderBlock(int index, int x, int y, int z) {
if (!count_XMin && !count_XMax && !count_ZMin && if (!count_XMin && !count_XMax && !count_ZMin &&
!count_ZMax && !count_YMin && !count_YMax) return; !count_ZMax && !count_YMin && !count_YMax) return;
fullBright = Blocks.FullBright[Builder_Block]; fullBright = Blocks.Brightness[Builder_Block];
baseOffset = (Blocks.Draw[Builder_Block] == DRAW_TRANSLUCENT) * ATLAS1D_MAX_ATLASES; baseOffset = (Blocks.Draw[Builder_Block] == DRAW_TRANSLUCENT) * ATLAS1D_MAX_ATLASES;
lightFlags = Blocks.LightOffset[Builder_Block]; lightFlags = Blocks.LightOffset[Builder_Block];
@ -809,9 +809,9 @@ static int Adv_Lit(int x, int y, int z, int cIndex) {
flags |= Lighting.IsLit_Fast(x, (y + 1) - offset, z) ? LIT_P1 : 0; flags |= Lighting.IsLit_Fast(x, (y + 1) - offset, z) ? LIT_P1 : 0;
/* If a block is fullbright, it should also look as if that spot is lit */ /* If a block is fullbright, it should also look as if that spot is lit */
if (Blocks.FullBright[Builder_Chunk[cIndex - 324]]) flags |= LIT_M1; if (Blocks.Brightness[Builder_Chunk[cIndex - 324]]) flags |= LIT_M1;
if (Blocks.FullBright[block]) flags |= LIT_CC; if (Blocks.Brightness[block]) flags |= LIT_CC;
if (Blocks.FullBright[Builder_Chunk[cIndex + 324]]) flags |= LIT_P1; if (Blocks.Brightness[Builder_Chunk[cIndex + 324]]) flags |= LIT_P1;
return flags; return flags;
} }
@ -1208,7 +1208,7 @@ static void Adv_RenderBlock(int index, int x, int y, int z) {
if (!count_XMin && !count_XMax && !count_ZMin && if (!count_XMin && !count_XMax && !count_ZMin &&
!count_ZMax && !count_YMin && !count_YMax) return; !count_ZMax && !count_YMin && !count_YMax) return;
Builder_FullBright = Blocks.FullBright[Builder_Block]; Builder_FullBright = Blocks.Brightness[Builder_Block];
adv_baseOffset = (Blocks.Draw[Builder_Block] == DRAW_TRANSLUCENT) * ATLAS1D_MAX_ATLASES; adv_baseOffset = (Blocks.Draw[Builder_Block] == DRAW_TRANSLUCENT) * ATLAS1D_MAX_ATLASES;
adv_tinted = Blocks.Tinted[Builder_Block]; adv_tinted = Blocks.Tinted[Builder_Block];
@ -1559,7 +1559,7 @@ static void Modern_RenderBlock(int index, int x, int y, int z) {
if (!count_XMin && !count_XMax && !count_ZMin && if (!count_XMin && !count_XMax && !count_ZMin &&
!count_ZMax && !count_YMin && !count_YMax) return; !count_ZMax && !count_YMin && !count_YMax) return;
Builder_FullBright = Blocks.FullBright[Builder_Block]; Builder_FullBright = Blocks.Brightness[Builder_Block];
adv_baseOffset = (Blocks.Draw[Builder_Block] == DRAW_TRANSLUCENT) * ATLAS1D_MAX_ATLASES; adv_baseOffset = (Blocks.Draw[Builder_Block] == DRAW_TRANSLUCENT) * ATLAS1D_MAX_ATLASES;
adv_tinted = Blocks.Tinted[Builder_Block]; adv_tinted = Blocks.Tinted[Builder_Block];

View File

@ -698,7 +698,7 @@ static void UpdateMapSides(void) {
data = (struct VertexTextured*)Gfx_RecreateAndLockVb(&sides_vb, data = (struct VertexTextured*)Gfx_RecreateAndLockVb(&sides_vb,
VERTEX_FORMAT_TEXTURED, sides_vertices); VERTEX_FORMAT_TEXTURED, sides_vertices);
sides_fullBright = Blocks.FullBright[block]; sides_fullBright = Blocks.Brightness[block];
color = sides_fullBright ? PACKEDCOL_WHITE : Env.ShadowCol; color = sides_fullBright ? PACKEDCOL_WHITE : Env.ShadowCol;
Block_Tint(color, block) Block_Tint(color, block)
@ -744,7 +744,7 @@ static void UpdateMapEdges(void) {
data = (struct VertexTextured*)Gfx_RecreateAndLockVb(&edges_vb, data = (struct VertexTextured*)Gfx_RecreateAndLockVb(&edges_vb,
VERTEX_FORMAT_TEXTURED, edges_vertices); VERTEX_FORMAT_TEXTURED, edges_vertices);
edges_fullBright = Blocks.FullBright[block]; edges_fullBright = Blocks.Brightness[block];
color = edges_fullBright ? PACKEDCOL_WHITE : Env.SunCol; color = edges_fullBright ? PACKEDCOL_WHITE : Env.SunCol;
Block_Tint(color, block) Block_Tint(color, block)

View File

@ -761,7 +761,7 @@ static void Cw_Callback_5(struct NbtTag* tag) {
if (IsTag(tag, "CollideType")) { Blocks.Collide[id] = NbtTag_U8(tag); return; } if (IsTag(tag, "CollideType")) { Blocks.Collide[id] = NbtTag_U8(tag); return; }
if (IsTag(tag, "Speed")) { Blocks.SpeedMultiplier[id] = NbtTag_F32(tag); return; } if (IsTag(tag, "Speed")) { Blocks.SpeedMultiplier[id] = NbtTag_F32(tag); return; }
if (IsTag(tag, "TransmitsLight")) { Blocks.BlocksLight[id] = NbtTag_U8(tag) == 0; return; } if (IsTag(tag, "TransmitsLight")) { Blocks.BlocksLight[id] = NbtTag_U8(tag) == 0; return; }
if (IsTag(tag, "FullBright")) { Blocks.FullBright[id] = NbtTag_U8(tag) != 0; return; } if (IsTag(tag, "FullBright")) { Blocks.Brightness[id] = NbtTag_U8(tag) != 0; return; }
if (IsTag(tag, "BlockDraw")) { Blocks.Draw[id] = NbtTag_U8(tag); return; } if (IsTag(tag, "BlockDraw")) { Blocks.Draw[id] = NbtTag_U8(tag); return; }
if (IsTag(tag, "Shape")) { Blocks.SpriteOffset[id] = NbtTag_U8(tag); return; } if (IsTag(tag, "Shape")) { Blocks.SpriteOffset[id] = NbtTag_U8(tag); return; }
@ -1407,7 +1407,7 @@ static cc_result Cw_WriteBockDef(struct Stream* stream, int b) {
cur = Nbt_WriteUInt8(cur, "TransmitsLight", Blocks.BlocksLight[b] ? 0 : 1); cur = Nbt_WriteUInt8(cur, "TransmitsLight", Blocks.BlocksLight[b] ? 0 : 1);
cur = Nbt_WriteUInt8(cur, "WalkSound", Blocks.DigSounds[b]); cur = Nbt_WriteUInt8(cur, "WalkSound", Blocks.DigSounds[b]);
cur = Nbt_WriteUInt8(cur, "FullBright", Blocks.FullBright[b] ? 1 : 0); cur = Nbt_WriteUInt8(cur, "FullBright", Blocks.Brightness[b] ? 1 : 0);
cur = Nbt_WriteUInt8(cur, "Shape", sprite ? 0 : (cc_uint8)(Blocks.MaxBB[b].Y * 16)); cur = Nbt_WriteUInt8(cur, "Shape", sprite ? 0 : (cc_uint8)(Blocks.MaxBB[b].Y * 16));
cur = Nbt_WriteUInt8(cur, "BlockDraw", sprite ? Blocks.SpriteOffset[b] : Blocks.Draw[b]); cur = Nbt_WriteUInt8(cur, "BlockDraw", sprite ? Blocks.SpriteOffset[b] : Blocks.Draw[b]);

View File

@ -139,7 +139,7 @@ void IsometricDrawer_BeginBatch(struct VertexTextured* vertices, GfxResourceID v
} }
void IsometricDrawer_DrawBatch(BlockID block, float size, float x, float y) { void IsometricDrawer_DrawBatch(BlockID block, float size, float x, float y) {
cc_bool bright = Blocks.FullBright[block]; cc_bool bright = Blocks.Brightness[block];
Vec3 min, max; Vec3 min, max;
if (Blocks.Draw[block] == DRAW_GAS) return; if (Blocks.Draw[block] == DRAW_GAS) return;

View File

@ -618,8 +618,8 @@ static cc_uint8 GetBlocklight(int x, int y, int z, cc_bool sun) {
} }
static cc_bool CanLightPass(BlockID thisBlock, Face face) { static cc_bool CanLightPass(BlockID thisBlock, Face face) {
/* If it's not opaque and it doesn't block light, or it's fullbright, we can always pass through */ /* If it's not opaque and it doesn't block light, or it is brighter than 0, we can always pass through */
if ((Blocks.Draw[thisBlock] > DRAW_OPAQUE && !Blocks.BlocksLight[thisBlock]) || Blocks.FullBright[thisBlock]) { return true; } if ((Blocks.Draw[thisBlock] > DRAW_OPAQUE && !Blocks.BlocksLight[thisBlock]) || Blocks.Brightness[thisBlock]) { return true; }
/* Light can always pass through leaves and water */ /* Light can always pass through leaves and water */
if (Blocks.Draw[thisBlock] == DRAW_TRANSPARENT_THICK || Blocks.Draw[thisBlock] == DRAW_TRANSLUCENT) { return true; } if (Blocks.Draw[thisBlock] == DRAW_TRANSPARENT_THICK || Blocks.Draw[thisBlock] == DRAW_TRANSLUCENT) { return true; }
@ -627,7 +627,7 @@ static cc_bool CanLightPass(BlockID thisBlock, Face face) {
/* We can assume a block is full sized if none of the LightOffset flags are 0 */ /* We can assume a block is full sized if none of the LightOffset flags are 0 */
if (Blocks.BlocksLight[thisBlock] && Blocks.LightOffset[thisBlock] == 0xFF) { return false; } if (Blocks.BlocksLight[thisBlock] && Blocks.LightOffset[thisBlock] == 0xFF) { return false; }
/* Is stone's face hidden by thisBlock? */ /* Is stone's face hidden by thisBlock? TODO: Don't hardcode using stone */
return !Block_IsFaceHidden(BLOCK_STONE, thisBlock, face); return !Block_IsFaceHidden(BLOCK_STONE, thisBlock, face);
} }
@ -824,8 +824,8 @@ static void CalculateChunkLightingSelf(int chunkIndex, int cx, int cy, int cz) {
for (x = chunkStartX; x < chunkEndX; x++) { for (x = chunkStartX; x < chunkEndX; x++) {
BlockID curBlock = World_GetBlock(x, y, z); BlockID curBlock = World_GetBlock(x, y, z);
if (Blocks.FullBright[curBlock]) { if (Blocks.Brightness[curBlock]) {
CalcBlockLight(MODERN_LIGHTING_MAX_LEVEL, x, y, z); CalcBlockLight(Blocks.Brightness[curBlock], x, y, z);
} }
//this cell is exposed to sunlight //this cell is exposed to sunlight

View File

@ -2062,7 +2062,7 @@ static void BlockModel_Draw(struct Entity* p) {
bModel_index = 0; bModel_index = 0;
if (Blocks.Draw[bModel_block] == DRAW_GAS) return; if (Blocks.Draw[bModel_block] == DRAW_GAS) return;
if (Blocks.FullBright[bModel_block]) { if (Blocks.Brightness[bModel_block]) {
for (i = 0; i < FACE_COUNT; i++) { for (i = 0; i < FACE_COUNT; i++) {
Models.Cols[i] = PACKEDCOL_WHITE; Models.Cols[i] = PACKEDCOL_WHITE;
} }

View File

@ -221,7 +221,7 @@ static void TerrainParticle_Render(struct TerrainParticle* p, float t, struct Ve
Vec3_Lerp(&pos, &p->base.lastPos, &p->base.nextPos, t); Vec3_Lerp(&pos, &p->base.lastPos, &p->base.nextPos, t);
size.X = p->base.size * 0.015625f; size.Y = size.X; size.X = p->base.size * 0.015625f; size.Y = size.X;
if (!Blocks.FullBright[p->block]) { if (!Blocks.Brightness[p->block]) {
x = Math_Floor(pos.X); y = Math_Floor(pos.Y); z = Math_Floor(pos.Z); x = Math_Floor(pos.X); y = Math_Floor(pos.Y); z = Math_Floor(pos.Z);
col = Lighting.Color_XSide(x, y, z); col = Lighting.Color_XSide(x, y, z);
} }

View File

@ -1701,7 +1701,7 @@ static BlockID BlockDefs_DefineBlockCommonStart(cc_uint8** ptr, cc_bool uniqueSi
Blocks.DigSounds[block] = sound; Blocks.DigSounds[block] = sound;
if (sound == SOUND_GLASS) Blocks.StepSounds[block] = SOUND_STONE; if (sound == SOUND_GLASS) Blocks.StepSounds[block] = SOUND_STONE;
Blocks.FullBright[block] = *data++ != 0; Blocks.Brightness[block] = *data++ != 0;
*ptr = data; *ptr = data;
return block; return block;
} }