Fix texturing

This commit is contained in:
Miloslav Číž 2018-09-09 19:11:44 +02:00
parent 923bd0d31c
commit 69fac865ee
2 changed files with 90 additions and 3 deletions

View file

@ -40,7 +40,7 @@ const unsigned char level[] =
0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,1,1,0,1,1,1,1,1,0,0,1,1,1, // 9
0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1, // 10
0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,1,0,0,0,0,0,3,0,1, // 11
1,3,1,0,1,1,1,1,1,1,2,0,2,2,3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1, // 12
1,3,1,0,1,1,4,4,4,1,2,0,2,2,3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1, // 12
0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1, // 13
0,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, // 14
0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,3,0,3,0,3,0,1 // 15
@ -307,6 +307,93 @@ const unsigned char texture3[] =
,0x09,0x09,0x11,0x08
};
const unsigned char texture4[] =
{ 32, 36 // width, height
,0x00,0x09,0x00,0x00,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xbd
,0xbd,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09
,0xbd,0xbd,0xbd,0xa3,0x09,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0xa3,0xa3
,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0xa3
,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0x59
,0x09,0x09,0x00,0x09,0x00,0x00,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd
,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51
,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00
,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3
,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3
,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x51,0x51,0x51,0x51,0x51,0x09
,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0x51,0x51,0x51,0x51
,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x08
,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3
,0xa3,0xa3,0x51,0x09,0x09,0x09,0x09,0x09,0x09,0xbd,0xa3,0xa3,0xa3,0xa3
,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x73,0x73,0x73,0x73
,0x21,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0x59,0x59,0x59
,0x59,0x59,0x61,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09
,0x00,0x08,0x00,0x00,0x21,0x21,0x21,0x21,0x21,0x09,0xa3,0xa3,0xa3,0xa3
,0xa3,0xa3,0xa3,0x51,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x09,0xa3,0xa3
,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x21,0x21
,0x21,0x21,0x21,0x21,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0x59,0x61
,0x61,0x61,0x61,0x61,0x61,0x61,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x11
,0x09,0x09,0x00,0x09,0x00,0x00,0x21,0x21,0x21,0x21,0x21,0x21,0x09,0xa3
,0x51,0x51,0x51,0x51,0x51,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x61,0x61
,0x09,0xa3,0x51,0x51,0x51,0x51,0x51,0x59,0x09,0x09,0x00,0x09,0x00,0x00
,0x21,0x21,0x21,0x21,0x21,0x21,0x19,0x09,0x09,0x09,0x09,0x09,0x09,0x59
,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0xa3,0x09,0x09,0x09,0x09,0x09
,0x09,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x21,0x21,0x21,0x21,0x21,0x19
,0x09,0xbd,0xbd,0xbd,0xbd,0xbd,0xa3,0x09,0x61,0x61,0x61,0x61,0x61,0x61
,0x61,0x9b,0x09,0x59,0x59,0x59,0x59,0x59,0x61,0x59,0x09,0x09,0x00,0x09
,0x00,0x00,0x21,0x21,0x21,0x21,0x19,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3
,0xa3,0x09,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x9b,0x59,0x61,0x61,0x61
,0x61,0x61,0x61,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x21,0x21,0x21,0x21
,0x19,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0x61,0x61,0x61
,0x61,0x61,0xa3,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x61,0x59,0x09,0x09
,0x00,0x09,0x00,0x00,0x19,0x19,0x19,0x19,0x09,0xbd,0xa3,0xa3,0xa3,0xa3
,0xa3,0xa3,0xa3,0xa3,0x09,0x61,0xa3,0xa3,0xa3,0xa3,0x09,0x59,0x61,0x61
,0x61,0x61,0x61,0x61,0x61,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x09,0x09
,0x09,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09
,0x09,0x09,0x09,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x59
,0x09,0x09,0x00,0x09,0x00,0x00,0x59,0x59,0x59,0x61,0x09,0xa3,0xa3,0xa3
,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0x59,0x59,0x59,0x61,0x09,0x61
,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x59,0x09,0x09,0x00,0x09,0x00,0x00
,0x61,0x61,0x61,0x61,0x61,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51
,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x09,0x61,0x61,0x61,0x61,0x61,0x61
,0x61,0x11,0x09,0x09,0x00,0x09,0x00,0x00,0x61,0x61,0x61,0x61,0x61,0x09
,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0x59,0x61,0x61,0x61,0x61
,0x61,0x09,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x59,0x09,0x09,0x00,0x09
,0x00,0x00,0x61,0x61,0x61,0x61,0x61,0x61,0x09,0xa3,0xa3,0xa3,0xa3,0xa3
,0x51,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x09,0x61,0x61,0x61
,0x61,0x61,0xa3,0x59,0x09,0x09,0x00,0x08,0x00,0x00,0x61,0x61,0x61,0x61
,0x61,0x61,0x09,0xa3,0x51,0x51,0x51,0x51,0x51,0x09,0x59,0x61,0x61,0x61
,0x61,0x61,0x61,0x61,0x09,0x61,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09
,0x00,0x09,0x00,0x00,0x61,0x61,0x61,0x61,0x61,0x61,0xa3,0x09,0x09,0x09
,0x09,0x09,0x09,0x59,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0xa3,0x09
,0x09,0x09,0x09,0x09,0x09,0x59,0x09,0x09,0x00,0x08,0x00,0x00,0x61,0x61
,0x61,0x61,0x61,0xa3,0x09,0xbd,0xbd,0xbd,0xbd,0xbd,0xa3,0x09,0x61,0x61
,0x61,0x61,0x61,0x61,0x61,0xa3,0x09,0xbd,0xbd,0xbd,0xbd,0xbd,0xa3,0x59
,0x09,0x09,0x00,0x09,0x00,0x00,0x61,0x61,0x61,0x61,0xa3,0x09,0xbd,0xa3
,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0x61,0x61,0x61,0x61,0x61,0x61,0xa3,0x09
,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00
,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3
,0x09,0x61,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3
,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0xbd
,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0x09,0x09,0x09,0x09
,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x09
,0x00,0x00,0xbd,0xbd,0xbd,0xbd,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3
,0xa3,0x51,0x09,0xbd,0xbd,0xbd,0xbd,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3
,0xa3,0xa3,0xa3,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0xa3,0xa3,0xa3,0xa3
,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xa3,0xa3
,0xa3,0xa3,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x59,0x09,0x09
,0x00,0x09,0x00,0x00,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0xa3,0xa3,0xa3
,0xa3,0xa3,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0xa3
,0xa3,0xa3,0xa3,0xa3,0x51,0x59,0x09,0x09,0x00,0x09,0x00,0x00,0xa3,0xa3
,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x09,0xbd,0xa3
,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3,0xa3,0xa3,0xa3,0xa3,0x51,0x59
,0x09,0x09,0x00,0x09,0x00,0x00,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0xa3
,0x51,0x51,0x51,0x51,0x09,0xbd,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3
,0x09,0xa3,0x51,0x51,0x51,0x51,0x19,0x59,0x09,0x09,0x00,0x09,0x00,0x00
,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0x09,0x09,0x09,0x09,0xbd,0xa3
,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x09,0x09,0x09,0x09,0x09
,0x09,0x59,0x09,0x09
};
const unsigned char sprite1[] =
{ 32, 32 // width, height
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00
@ -463,7 +550,7 @@ const unsigned char sprite2[] =
,0x07,0x07
};
const unsigned char *textures[] = {texture1, texture2, texture3};
const unsigned char *textures[] = {texture1, texture2, texture3, texture4};
Unit floorHeightAt(int16_t x, int16_t y)
{

View file

@ -126,7 +126,7 @@ inline uint8_t sampleImage(const unsigned char *image, Unit x, Unit y)
y = wrap(y,UNITS_PER_SQUARE);
int32_t index =
image[1] * ((image[1] * x) / UNITS_PER_SQUARE) + (image[0] * y) /
image[1] * ((image[0] * x) / UNITS_PER_SQUARE) + (image[0] * y) /
UNITS_PER_SQUARE;
return image[2 + index];