Merge branch 'master' into sokol
This commit is contained in:
commit
9507749ff1
14
src/tic.c
14
src/tic.c
|
@ -293,8 +293,18 @@ static void drawRectBorder(tic_machine* machine, s32 x, s32 y, s32 width, s32 he
|
||||||
static void drawTile(tic_machine* machine, const tic_tile* buffer, s32 x, s32 y, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate)
|
static void drawTile(tic_machine* machine, const tic_tile* buffer, s32 x, s32 y, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate)
|
||||||
{
|
{
|
||||||
static u8 mapping[TIC_PALETTE_SIZE];
|
static u8 mapping[TIC_PALETTE_SIZE];
|
||||||
for (s32 i = 0; i < TIC_PALETTE_SIZE; i++) mapping[i] = tic_tool_peek4(machine->memory.ram.vram.mapping, i);
|
for (s32 i = 0; i < TIC_PALETTE_SIZE; i++)
|
||||||
for (s32 i = 0; i < count; i++) mapping[colors[i]] = 255;
|
{
|
||||||
|
u8 mapped = tic_tool_peek4(machine->memory.ram.vram.mapping, i);
|
||||||
|
for (s32 j = 0; j < count; j++)
|
||||||
|
{
|
||||||
|
if (mapped == colors[j]) {
|
||||||
|
mapped = 255;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapping[i] = mapped;
|
||||||
|
}
|
||||||
|
|
||||||
rotate &= 0b11;
|
rotate &= 0b11;
|
||||||
u32 orientation = flip & 0b11;
|
u32 orientation = flip & 0b11;
|
||||||
|
|
|
@ -1363,6 +1363,8 @@ static const char* const WrenKeywords [] =
|
||||||
"static", "super", "this", "true", "var", "while"
|
"static", "super", "this", "true", "var", "while"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool isalnum_(char c) {return isalnum(c) || c == '_';}
|
||||||
|
|
||||||
static const tic_outline_item* getWrenOutline(const char* code, s32* size)
|
static const tic_outline_item* getWrenOutline(const char* code, s32* size)
|
||||||
{
|
{
|
||||||
enum{Size = sizeof(tic_outline_item)};
|
enum{Size = sizeof(tic_outline_item)};
|
||||||
|
@ -1371,6 +1373,55 @@ static const tic_outline_item* getWrenOutline(const char* code, s32* size)
|
||||||
|
|
||||||
static tic_outline_item* items = NULL;
|
static tic_outline_item* items = NULL;
|
||||||
|
|
||||||
|
if(items)
|
||||||
|
{
|
||||||
|
free(items);
|
||||||
|
items = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* ptr = code;
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
static const char ClassString[] = "class ";
|
||||||
|
|
||||||
|
ptr = strstr(ptr, ClassString);
|
||||||
|
|
||||||
|
if(ptr)
|
||||||
|
{
|
||||||
|
ptr += sizeof ClassString - 1;
|
||||||
|
|
||||||
|
const char* start = ptr;
|
||||||
|
const char* end = start;
|
||||||
|
|
||||||
|
while(*ptr)
|
||||||
|
{
|
||||||
|
char c = *ptr;
|
||||||
|
|
||||||
|
if(isalnum_(c));
|
||||||
|
else if(c == ' ' || c == '{')
|
||||||
|
{
|
||||||
|
end = ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(end > start)
|
||||||
|
{
|
||||||
|
items = items ? realloc(items, (*size + 1) * Size) : malloc(Size);
|
||||||
|
|
||||||
|
items[*size].pos = start - code;
|
||||||
|
items[*size].size = end - start;
|
||||||
|
|
||||||
|
(*size)++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue