mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-10-04 11:35:11 -04:00
fix merge conflicts
This commit is contained in:
commit
dfaa93672c
@ -21,6 +21,7 @@ echo "Comment=Minecraft Classic inspired sandbox game" >> $DESKTOP_FILE
|
|||||||
echo "Name=ClassiCube" >> $DESKTOP_FILE
|
echo "Name=ClassiCube" >> $DESKTOP_FILE
|
||||||
echo "Exec=$GAME_DIR/ClassiCube" >> $DESKTOP_FILE
|
echo "Exec=$GAME_DIR/ClassiCube" >> $DESKTOP_FILE
|
||||||
echo "Icon=$GAME_DIR/CCicon.png" >> $DESKTOP_FILE
|
echo "Icon=$GAME_DIR/CCicon.png" >> $DESKTOP_FILE
|
||||||
|
echo "Path=$GAME_DIR" >> $DESKTOP_FILE
|
||||||
echo "Terminal=false" >> $DESKTOP_FILE
|
echo "Terminal=false" >> $DESKTOP_FILE
|
||||||
echo "Categories=Game;" >> $DESKTOP_FILE
|
echo "Categories=Game;" >> $DESKTOP_FILE
|
||||||
chmod +x $DESKTOP_FILE
|
chmod +x $DESKTOP_FILE
|
||||||
|
@ -313,12 +313,14 @@ void Block_CalcLightOffset(BlockID block) {
|
|||||||
if (max.X != 1) flags &= ~(1 << FACE_XMAX);
|
if (max.X != 1) flags &= ~(1 << FACE_XMAX);
|
||||||
if (min.Z != 0) flags &= ~(1 << FACE_ZMIN);
|
if (min.Z != 0) flags &= ~(1 << FACE_ZMIN);
|
||||||
if (max.Z != 1) flags &= ~(1 << FACE_ZMAX);
|
if (max.Z != 1) flags &= ~(1 << FACE_ZMAX);
|
||||||
|
if (min.Y != 0) flags &= ~(1 << FACE_YMIN);
|
||||||
|
if (max.Y != 1) flags &= ~(1 << FACE_YMAX);
|
||||||
|
|
||||||
if (min.Y != 0) flags &= ~(1 << FACE_YMIN);
|
if (min.Y != 0) flags &= ~(1 << FACE_YMIN);
|
||||||
if (max.Y != 1) flags &= ~(1 << FACE_YMAX);
|
if (max.Y != 1) flags &= ~(1 << FACE_YMAX);
|
||||||
|
|
||||||
if ((min.Y != 0 && max.Y == 1) && Blocks.Draw[block] != DRAW_GAS) {
|
if ((min.Y != 0 && max.Y == 1) && Blocks.Draw[block] != DRAW_GAS) {
|
||||||
flags &= ~(1 << BLOCK_LIGHT_OFFSET_IS_UPPER_SLAB);
|
flags &= ~(1 << LIGHT_FLAG_SHADES_FROM_BELOW);
|
||||||
}
|
}
|
||||||
Blocks.LightOffset[block] = flags;
|
Blocks.LightOffset[block] = flags;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,11 @@ CC_VAR extern struct _BlockLists {
|
|||||||
#define Block_Tint(col, block)\
|
#define Block_Tint(col, block)\
|
||||||
if (Blocks.Tinted[block]) col = PackedCol_Tint(col, Blocks.FogCol[block]);
|
if (Blocks.Tinted[block]) col = PackedCol_Tint(col, Blocks.FogCol[block]);
|
||||||
|
|
||||||
#define BLOCK_LIGHT_OFFSET_IS_UPPER_SLAB 6
|
/* Most blocks which 'stop' light actually stop the light starting at block below */
|
||||||
|
/* except for e.g. upside down slabs which 'stop' the light at same block level */
|
||||||
|
/* 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 */
|
||||||
|
#define LIGHT_FLAG_SHADES_FROM_BELOW 6
|
||||||
|
|
||||||
/* 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);
|
||||||
|
@ -794,15 +794,18 @@ static int Adv_Lit(int x, int y, int z, int cIndex) {
|
|||||||
block = Builder_Chunk[cIndex];
|
block = Builder_Chunk[cIndex];
|
||||||
lightFlags = Blocks.LightOffset[block];
|
lightFlags = Blocks.LightOffset[block];
|
||||||
|
|
||||||
|
/* TODO using LIGHT_FLAG_SHADES_FROM_BELOW is wrong here, */
|
||||||
|
/* but still produces less broken results than YMIN/YMAX */
|
||||||
|
|
||||||
/* Use fact Light(Y.YMin) == Light((Y-1).YMax) */
|
/* Use fact Light(Y.YMin) == Light((Y-1).YMax) */
|
||||||
offset = (lightFlags >> FACE_YMIN) & 1;
|
offset = (lightFlags >> LIGHT_FLAG_SHADES_FROM_BELOW) & 1;
|
||||||
flags |= Lighting.IsLit_Fast(x, y - offset, z) ? LIT_M1 : 0;
|
flags |= Lighting.IsLit_Fast(x, y - offset, z) ? LIT_M1 : 0;
|
||||||
|
|
||||||
/* Light is same for all the horizontal faces */
|
/* Light is same for all the horizontal faces */
|
||||||
flags |= Lighting.IsLit_Fast(x, y, z) ? LIT_CC : 0;
|
flags |= Lighting.IsLit_Fast(x, y, z) ? LIT_CC : 0;
|
||||||
|
|
||||||
/* Use fact Light((Y+1).YMin) == Light(Y.YMax) */
|
/* Use fact Light((Y+1).YMin) == Light(Y.YMax) */
|
||||||
offset = (lightFlags >> FACE_YMAX) & 1;
|
offset = (lightFlags >> LIGHT_FLAG_SHADES_FROM_BELOW) & 1;
|
||||||
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 */
|
||||||
|
@ -316,16 +316,18 @@ cc_bool Drawer2D_ValidColorCodeAt(const cc_string* text, int i) {
|
|||||||
return BitmapCol_A(Drawer2D_GetColor(text->buffer[i])) != 0;
|
return BitmapCol_A(Drawer2D_GetColor(text->buffer[i])) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_bool Drawer2D_UNSAFE_NextPart(cc_string* left, cc_string* part, BitmapCol* color) {
|
cc_bool Drawer2D_UNSAFE_NextPart(cc_string* left, cc_string* part, char* colorCode) {
|
||||||
BitmapCol c;
|
BitmapCol color;
|
||||||
|
char cur;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* check if current part starts with a colour code */
|
/* check if current part starts with a colour code */
|
||||||
if (left->length >= 2 && left->buffer[0] == '&') {
|
if (left->length >= 2 && left->buffer[0] == '&') {
|
||||||
c = Drawer2D_GetColor(left->buffer[1]);
|
cur = left->buffer[1];
|
||||||
|
color = Drawer2D_GetColor(cur);
|
||||||
|
|
||||||
if (BitmapCol_A(c)) {
|
if (BitmapCol_A(color)) {
|
||||||
*color = c;
|
*colorCode = cur;
|
||||||
left->buffer += 2;
|
left->buffer += 2;
|
||||||
left->length -= 2;
|
left->length -= 2;
|
||||||
}
|
}
|
||||||
@ -347,9 +349,9 @@ cc_bool Drawer2D_UNSAFE_NextPart(cc_string* left, cc_string* part, BitmapCol* co
|
|||||||
|
|
||||||
cc_bool Drawer2D_IsEmptyText(const cc_string* text) {
|
cc_bool Drawer2D_IsEmptyText(const cc_string* text) {
|
||||||
cc_string left = *text, part;
|
cc_string left = *text, part;
|
||||||
BitmapCol color;
|
char colorCode;
|
||||||
|
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
if (part.length) return false;
|
if (part.length) return false;
|
||||||
}
|
}
|
||||||
@ -358,9 +360,9 @@ cc_bool Drawer2D_IsEmptyText(const cc_string* text) {
|
|||||||
|
|
||||||
void Drawer2D_WithoutColors(cc_string* str, const cc_string* src) {
|
void Drawer2D_WithoutColors(cc_string* str, const cc_string* src) {
|
||||||
cc_string left = *src, part;
|
cc_string left = *src, part;
|
||||||
BitmapCol color;
|
char colorCode;
|
||||||
|
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
String_AppendString(str, &part);
|
String_AppendString(str, &part);
|
||||||
}
|
}
|
||||||
@ -1287,10 +1289,10 @@ static int Font_SysTextWidth(struct DrawTextArgs* args) {
|
|||||||
struct FontDesc* font = args->font;
|
struct FontDesc* font = args->font;
|
||||||
cc_string left = args->text, part;
|
cc_string left = args->text, part;
|
||||||
double width = 0;
|
double width = 0;
|
||||||
BitmapCol color;
|
char colorCode;
|
||||||
|
|
||||||
interop_SetFont(font->handle, font->size, font->flags);
|
interop_SetFont(font->handle, font->size, font->flags);
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
char buffer[NATIVE_STR_LEN];
|
char buffer[NATIVE_STR_LEN];
|
||||||
int len = Platform_EncodeUtf8(buffer, &part);
|
int len = Platform_EncodeUtf8(buffer, &part);
|
||||||
@ -1302,7 +1304,8 @@ static int Font_SysTextWidth(struct DrawTextArgs* args) {
|
|||||||
static void Font_SysTextDraw(struct DrawTextArgs* args, struct Bitmap* bmp, int x, int y, cc_bool shadow) {
|
static void Font_SysTextDraw(struct DrawTextArgs* args, struct Bitmap* bmp, int x, int y, cc_bool shadow) {
|
||||||
struct FontDesc* font = args->font;
|
struct FontDesc* font = args->font;
|
||||||
cc_string left = args->text, part;
|
cc_string left = args->text, part;
|
||||||
BitmapCol color = Drawer2D.Colors['f'];
|
BitmapCol color;
|
||||||
|
char colorCode = 'f';
|
||||||
double xOffset = 0;
|
double xOffset = 0;
|
||||||
char hexBuffer[7];
|
char hexBuffer[7];
|
||||||
cc_string hex;
|
cc_string hex;
|
||||||
@ -1311,10 +1314,12 @@ static void Font_SysTextDraw(struct DrawTextArgs* args, struct Bitmap* bmp, int
|
|||||||
y += (args->font->height - args->font->size) / 2;
|
y += (args->font->height - args->font->size) / 2;
|
||||||
interop_SetFont(font->handle, font->size, font->flags);
|
interop_SetFont(font->handle, font->size, font->flags);
|
||||||
|
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
char buffer[NATIVE_STR_LEN];
|
char buffer[NATIVE_STR_LEN];
|
||||||
int len = Platform_EncodeUtf8(buffer, &part);
|
int len = Platform_EncodeUtf8(buffer, &part);
|
||||||
|
|
||||||
|
color = Drawer2D_GetColor(colorCode);
|
||||||
if (shadow) color = GetShadowColor(color);
|
if (shadow) color = GetShadowColor(color);
|
||||||
|
|
||||||
String_InitArray(hex, hexBuffer);
|
String_InitArray(hex, hexBuffer);
|
||||||
|
@ -91,7 +91,7 @@ void Drawer2D_WithoutColors(cc_string* str, const cc_string* src);
|
|||||||
char Drawer2D_LastColor(const cc_string* text, int start);
|
char Drawer2D_LastColor(const cc_string* text, int start);
|
||||||
/* Returns whether the color code is f, F or \0 */
|
/* Returns whether the color code is f, F or \0 */
|
||||||
cc_bool Drawer2D_IsWhiteColor(char c);
|
cc_bool Drawer2D_IsWhiteColor(char c);
|
||||||
cc_bool Drawer2D_UNSAFE_NextPart(cc_string* left, cc_string* part, BitmapCol* color);
|
cc_bool Drawer2D_UNSAFE_NextPart(cc_string* left, cc_string* part, char* colorCode);
|
||||||
|
|
||||||
/* Allocates a new instance of the default font using the given size and flags */
|
/* Allocates a new instance of the default font using the given size and flags */
|
||||||
/* Uses Font_MakeBitmapped or SysFont_MakeDefault depending on Drawer2D_BitmappedText */
|
/* Uses Font_MakeBitmapped or SysFont_MakeDefault depending on Drawer2D_BitmappedText */
|
||||||
|
@ -845,14 +845,17 @@ void LBackend_SliderDraw(struct LSlider* w) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------TableWidget-------------------------------------------------------*
|
*-------------------------------------------------------TableWidget-------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void LBackend_TableInit(struct LTable* w) {
|
static void InitRowFont(void) {
|
||||||
if (rowFont.handle) return;
|
if (rowFont.handle) return;
|
||||||
Font_Make(&rowFont, 11, FONT_FLAGS_NONE);
|
Font_Make(&rowFont, 11, FONT_FLAGS_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LBackend_TableInit(struct LTable* w) { }
|
||||||
void LBackend_TableUpdate(struct LTable* w) { }
|
void LBackend_TableUpdate(struct LTable* w) { }
|
||||||
|
|
||||||
void LBackend_TableReposition(struct LTable* w) {
|
void LBackend_TableReposition(struct LTable* w) {
|
||||||
int rowsHeight;
|
int rowsHeight;
|
||||||
|
InitRowFont();
|
||||||
w->hdrHeight = Font_CalcHeight(&textFont, true) + hdrYPadding;
|
w->hdrHeight = Font_CalcHeight(&textFont, true) + hdrYPadding;
|
||||||
w->rowHeight = Font_CalcHeight(&rowFont, true) + rowYPadding;
|
w->rowHeight = Font_CalcHeight(&rowFont, true) + rowYPadding;
|
||||||
|
|
||||||
@ -966,6 +969,7 @@ static void LTable_DrawRows(struct LTable* w) {
|
|||||||
struct LTableCell cell;
|
struct LTableCell cell;
|
||||||
int i, x, y, row, end;
|
int i, x, y, row, end;
|
||||||
|
|
||||||
|
InitRowFont();
|
||||||
String_InitArray(str, strBuffer);
|
String_InitArray(str, strBuffer);
|
||||||
DrawTextArgs_Make(&args, &str, &rowFont, true);
|
DrawTextArgs_Make(&args, &str, &rowFont, true);
|
||||||
cell.table = w;
|
cell.table = w;
|
||||||
|
@ -59,7 +59,7 @@ for (y = World.Height - 1; y >= 0; y--) {\
|
|||||||
x += curRunCount; mapIndex += curRunCount; index += curRunCount;\
|
x += curRunCount; mapIndex += curRunCount; index += curRunCount;\
|
||||||
\
|
\
|
||||||
if (x < xCount && Blocks.BlocksLight[get_block]) {\
|
if (x < xCount && Blocks.BlocksLight[get_block]) {\
|
||||||
lightOffset = (Blocks.LightOffset[get_block] >> BLOCK_LIGHT_OFFSET_IS_UPPER_SLAB) & 1;\
|
lightOffset = (Blocks.LightOffset[get_block] >> LIGHT_FLAG_SHADES_FROM_BELOW) & 1;\
|
||||||
heightmap[hIndex + x] = (cc_int16)(y - lightOffset);\
|
heightmap[hIndex + x] = (cc_int16)(y - lightOffset);\
|
||||||
elemsLeft--;\
|
elemsLeft--;\
|
||||||
skip[index] = 0;\
|
skip[index] = 0;\
|
||||||
@ -139,7 +139,7 @@ for (y = maxY; y >= 0; y--, i -= World.OneY) {\
|
|||||||
block = get_block;\
|
block = get_block;\
|
||||||
\
|
\
|
||||||
if (Blocks.BlocksLight[block]) {\
|
if (Blocks.BlocksLight[block]) {\
|
||||||
offset = (Blocks.LightOffset[block] >> BLOCK_LIGHT_OFFSET_IS_UPPER_SLAB) & 1;\
|
offset = (Blocks.LightOffset[block] >> LIGHT_FLAG_SHADES_FROM_BELOW) & 1;\
|
||||||
heightmap[hIndex] = y - offset;\
|
heightmap[hIndex] = y - offset;\
|
||||||
return y - offset;\
|
return y - offset;\
|
||||||
}\
|
}\
|
||||||
@ -238,8 +238,8 @@ static void ClassicLighting_LightHint(int startX, int startY, int startZ) {
|
|||||||
static void ClassicLighting_UpdateLighting(int x, int y, int z, BlockID oldBlock, BlockID newBlock, int index, int lightH) {
|
static void ClassicLighting_UpdateLighting(int x, int y, int z, BlockID oldBlock, BlockID newBlock, int index, int lightH) {
|
||||||
cc_bool didBlock = Blocks.BlocksLight[oldBlock];
|
cc_bool didBlock = Blocks.BlocksLight[oldBlock];
|
||||||
cc_bool nowBlocks = Blocks.BlocksLight[newBlock];
|
cc_bool nowBlocks = Blocks.BlocksLight[newBlock];
|
||||||
int oldOffset = (Blocks.LightOffset[oldBlock] >> BLOCK_LIGHT_OFFSET_IS_UPPER_SLAB) & 1;
|
int oldOffset = (Blocks.LightOffset[oldBlock] >> LIGHT_FLAG_SHADES_FROM_BELOW) & 1;
|
||||||
int newOffset = (Blocks.LightOffset[newBlock] >> BLOCK_LIGHT_OFFSET_IS_UPPER_SLAB) & 1;
|
int newOffset = (Blocks.LightOffset[newBlock] >> LIGHT_FLAG_SHADES_FROM_BELOW) & 1;
|
||||||
BlockID above;
|
BlockID above;
|
||||||
|
|
||||||
/* Two cases we need to handle here: */
|
/* Two cases we need to handle here: */
|
||||||
|
@ -427,6 +427,10 @@ void Clipboard_GetText(cc_string* value) {
|
|||||||
/* Window_StoreClipboardText may or may not be called by this */
|
/* Window_StoreClipboardText may or may not be called by this */
|
||||||
interop_TryGetClipboardText();
|
interop_TryGetClipboardText();
|
||||||
|
|
||||||
|
/* If text input is active, then let it handle pasting text */
|
||||||
|
/* (otherwise text gets pasted twice on mobile) */
|
||||||
|
if (Input_TouchMode && keyboardOpen) pasteStr.length = 0;
|
||||||
|
|
||||||
String_Copy(value, &pasteStr);
|
String_Copy(value, &pasteStr);
|
||||||
pasteStr.length = 0;
|
pasteStr.length = 0;
|
||||||
}
|
}
|
||||||
|
@ -251,11 +251,12 @@ static NSString* ToNSString(const cc_string* text) {
|
|||||||
|
|
||||||
static NSMutableAttributedString* ToAttributedString(const cc_string* text) {
|
static NSMutableAttributedString* ToAttributedString(const cc_string* text) {
|
||||||
cc_string left = *text, part;
|
cc_string left = *text, part;
|
||||||
BitmapCol color = Drawer2D.Colors['f'];
|
char colorCode = 'f';
|
||||||
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
|
BitmapCol color = Drawer2D_GetColor(colorCode);
|
||||||
NSString* bit = ToNSString(&part);
|
NSString* bit = ToNSString(&part);
|
||||||
NSDictionary* attrs =
|
NSDictionary* attrs =
|
||||||
@{
|
@{
|
||||||
@ -768,11 +769,12 @@ void interop_SysFontFree(void* handle) {
|
|||||||
int interop_SysTextWidth(struct DrawTextArgs* args) {
|
int interop_SysTextWidth(struct DrawTextArgs* args) {
|
||||||
UIFont* font = (__bridge UIFont*)args->font->handle;
|
UIFont* font = (__bridge UIFont*)args->font->handle;
|
||||||
cc_string left = args->text, part;
|
cc_string left = args->text, part;
|
||||||
BitmapCol color = Drawer2D.Colors['f'];
|
char colorCode = 'f';
|
||||||
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
|
BitmapCol color = Drawer2D_GetColor(colorCode);
|
||||||
NSString* bit = ToNSString(&part);
|
NSString* bit = ToNSString(&part);
|
||||||
NSDictionary* attrs =
|
NSDictionary* attrs =
|
||||||
@{
|
@{
|
||||||
@ -794,11 +796,12 @@ int interop_SysTextWidth(struct DrawTextArgs* args) {
|
|||||||
void interop_SysTextDraw(struct DrawTextArgs* args, struct Context2D* ctx, int x, int y, cc_bool shadow) {
|
void interop_SysTextDraw(struct DrawTextArgs* args, struct Context2D* ctx, int x, int y, cc_bool shadow) {
|
||||||
UIFont* font = (__bridge UIFont*)args->font->handle;
|
UIFont* font = (__bridge UIFont*)args->font->handle;
|
||||||
cc_string left = args->text, part;
|
cc_string left = args->text, part;
|
||||||
BitmapCol color = Drawer2D.Colors['f'];
|
char colorCode = 'f';
|
||||||
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
while (Drawer2D_UNSAFE_NextPart(&left, &part, &color))
|
while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode))
|
||||||
{
|
{
|
||||||
|
BitmapCol color = Drawer2D_GetColor(colorCode);
|
||||||
NSString* bit = ToNSString(&part);
|
NSString* bit = ToNSString(&part);
|
||||||
NSDictionary* attrs =
|
NSDictionary* attrs =
|
||||||
@{
|
@{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user