textri command #317

minor fixes
This commit is contained in:
BADIM-PC\Vadim 2017-09-28 23:36:19 +03:00
parent eb7319f46e
commit 1ec8406ee8
1 changed files with 10 additions and 7 deletions

View File

@ -734,7 +734,7 @@ static void setSidePixel(s32 x, s32 y)
static void setSideTexPixel(s32 x, s32 y, float u, float v) static void setSideTexPixel(s32 x, s32 y, float u, float v)
{ {
int yy = (s32)y; s32 yy = (s32)y;
if (yy >= 0 && yy < TIC80_HEIGHT) if (yy >= 0 && yy < TIC80_HEIGHT)
{ {
if (x < SidesBuffer.Left[yy]) if (x < SidesBuffer.Left[yy])
@ -759,7 +759,7 @@ static void api_circle(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
initSidesBuffer(); initSidesBuffer();
s32 r = radius; s32 r = radius;
int x = -r, y = 0, err = 2-2*r; s32 x = -r, y = 0, err = 2-2*r;
do do
{ {
setSidePixel(xm-x, ym+y); setSidePixel(xm-x, ym+y);
@ -780,7 +780,7 @@ static void api_circle(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
static void api_circle_border(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color) static void api_circle_border(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
{ {
s32 r = radius; s32 r = radius;
int x = -r, y = 0, err = 2-2*r; s32 x = -r, y = 0, err = 2-2*r;
do { do {
api_pixel(memory, xm-x, ym+y, color); api_pixel(memory, xm-x, ym+y, color);
api_pixel(memory, xm-y, ym-x, color); api_pixel(memory, xm-y, ym-x, color);
@ -900,8 +900,11 @@ static void api_textri(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3,
{ {
if (use_map == true) if (use_map == true)
{ {
int iu = (s32)u % 1920; enum {MapWidth = TIC_MAP_WIDTH * TIC_SPRITESIZE, MapHeight = TIC_MAP_HEIGHT * TIC_SPRITESIZE};
int iv = (s32)v % 1088;
s32 iu = (s32)u % MapWidth;
s32 iv = (s32)v % MapHeight;
u8 tile = map[(iv>>3) * TIC_MAP_WIDTH + (iu>>3)]; u8 tile = map[(iv>>3) * TIC_MAP_WIDTH + (iu>>3)];
const u8 *buffer = &ptr[tile << 5]; const u8 *buffer = &ptr[tile << 5];
u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3)); u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3));
@ -910,8 +913,8 @@ static void api_textri(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3,
} }
else else
{ {
int iu = (s32)(u) & 127; s32 iu = (s32)(u) & 127;
int iv = (s32)(v) & 255; s32 iv = (s32)(v) & 255;
const u8 *buffer = &ptr[((iu >> 3) + ((iv >> 3) << 4)) << 5]; const u8 *buffer = &ptr[((iu >> 3) + ((iv >> 3) << 4)) << 5];
u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3)); u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3));
if (color != chroma) if (color != chroma)