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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 }; const signed char levelFloor[] = @@ -109,7 +109,7 @@ const signed char levelCeiling[] = 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24 }; -const unsigned char image[] = +const unsigned char texture1[] = { 32, 32 // width, height ,0x12,0x65,0x65,0x6d,0x24,0x64,0x5b,0x12,0x12,0x64,0x5b,0x5b,0x12,0x51 ,0x12,0x09,0x00,0x6d,0x6d,0x6d,0x24,0x5b,0x5b,0x52,0x12,0x5b,0x52,0x5b @@ -187,85 +187,7 @@ const unsigned char image[] = ,0x52,0x09 }; -const unsigned char image2[] = -{ 32, 32 // width, height - ,0xff,0xff,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xb7,0x77 - ,0xbf,0x77,0x76,0x76,0x6e,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e - ,0x76,0x76,0x6e,0x25,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0x76,0x77,0x76,0x76 - ,0x76,0x76,0x6e,0x6e,0x76,0x76,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d - ,0x6d,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0xff,0xbf,0xbf,0x76,0x77,0x76 - ,0x76,0x76,0x76,0x6e,0x76,0x6e,0x6e,0x6e,0x6e,0x76,0x76,0x6e,0x6d,0x6d - ,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x65,0x6d,0x65,0xbf,0xbf - ,0x77,0x76,0x76,0x76,0x76,0x76,0x76,0x6e,0x76,0x76,0x6e,0x6e,0x76,0x76 - ,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x65,0x65,0x6d,0x6d,0x65,0x65,0x6d,0x65 - ,0x6d,0x6d,0xbf,0xbf,0x76,0x76,0x76,0x25,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c - ,0x1c,0x1c,0x24,0x25,0x25,0x24,0x1c,0x1c,0x1c,0x1c,0x1c,0x24,0x24,0x24 - ,0x24,0x25,0x6d,0x65,0x6d,0x6d,0xbf,0xbf,0x77,0x76,0x76,0x24,0x1c,0x1c - ,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x24,0x25,0x65,0x25,0x24,0x1c,0x1c,0x1c - ,0x24,0x24,0x24,0x1c,0x24,0x6d,0x6d,0x6d,0x6e,0x6d,0xbf,0xbf,0x76,0x76 - ,0x76,0x1c,0x1c,0x76,0x76,0x6e,0x76,0x6e,0x6e,0x6e,0x6e,0x76,0x76,0x76 - ,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x76,0x77,0x6d,0x6d,0x6e,0x6d - ,0xbf,0xbf,0x77,0x76,0x76,0x1c,0x24,0x76,0x76,0x76,0x76,0x6e,0x6e,0x6e - ,0x76,0x76,0x77,0x77,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x76,0xb7 - ,0x6e,0x6e,0x6e,0x25,0xbf,0xbf,0x77,0x76,0x76,0x24,0x24,0x77,0x76,0x76 - ,0x76,0x76,0x6e,0x6e,0x76,0x76,0x77,0x77,0x76,0x6e,0x6d,0x6d,0x6d,0x6d - ,0x6d,0x6d,0x76,0xbf,0x76,0x6e,0x6d,0x24,0xbf,0xbf,0x77,0x76,0x77,0x24 - ,0x25,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x6e - ,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x77,0xbf,0x6e,0x6d,0x6d,0x25,0xbf,0xbf - ,0x77,0x77,0x77,0x25,0x25,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76 - ,0x76,0x76,0x76,0x76,0x6e,0x6d,0x6d,0x6d,0x65,0x6d,0xbf,0xbf,0x6e,0x6d - ,0x6e,0x25,0xbf,0xbf,0x77,0x76,0xb7,0x25,0x65,0x76,0x76,0x6e,0x76,0x76 - ,0x76,0x76,0x76,0x6e,0x6e,0x76,0x76,0x76,0x6e,0x6d,0x6d,0x6d,0x65,0x6e - ,0xbf,0xbf,0x6d,0x65,0x6e,0x6d,0xbf,0xbf,0x77,0x76,0x77,0x25,0x25,0x77 - ,0x76,0x6e,0x76,0x76,0x6e,0x76,0x6e,0x6e,0x6e,0x6e,0x76,0x77,0x76,0x6e - ,0x6d,0x6d,0x6d,0x6e,0xbf,0xbf,0x6d,0x65,0x76,0x6d,0xff,0xbf,0xbf,0xbf - ,0xbf,0x24,0x25,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x6e,0x6e,0x6e,0x6e - ,0x76,0x76,0x76,0x6e,0x6e,0x6e,0x76,0x76,0xbf,0xbf,0x6d,0x6d,0x76,0x6e - ,0xff,0xbf,0xbf,0xbf,0xbf,0x24,0x6d,0x76,0x76,0x76,0x76,0x76,0x76,0x6e - ,0x6e,0x6d,0x6e,0x6e,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0xbf,0x77 - ,0x65,0x6d,0x76,0x6e,0xbf,0xbf,0x77,0x77,0x77,0x25,0x6d,0x77,0x77,0x76 - ,0x76,0x76,0x76,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x76,0x76,0x77,0x77,0x76 - ,0x76,0x6e,0x77,0x76,0x65,0x6d,0x6e,0x76,0xbf,0xbf,0x77,0x76,0x76,0x25 - ,0x6d,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x6e,0x6d,0x6d,0x6e,0x6d,0x6e - ,0x76,0x77,0x76,0x76,0x6e,0x6d,0x77,0x77,0x65,0x6d,0x76,0x6d,0xff,0xbf - ,0xbf,0x77,0x77,0x24,0x6d,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x6d,0x6d - ,0x6d,0x6e,0x6d,0x6e,0x6e,0x76,0x6e,0x6d,0x6d,0x65,0x76,0x77,0x25,0x6d - ,0x6e,0x6e,0xff,0xbf,0xbf,0x77,0x77,0x24,0x65,0x77,0x77,0x76,0x76,0x76 - ,0x76,0x76,0x6e,0x6d,0x6e,0x6e,0x6e,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6d - ,0x76,0x77,0x25,0x25,0x76,0x6e,0xff,0xbf,0xbf,0xb7,0x77,0x25,0x24,0x77 - ,0x77,0x76,0x76,0x76,0x6e,0x6e,0x76,0x6e,0x6e,0x76,0x6e,0x6e,0x6e,0x6e - ,0x6d,0x6d,0x6d,0x6d,0x76,0x77,0x25,0x25,0x6d,0x6d,0xff,0xbf,0x77,0x77 - ,0x77,0x25,0x24,0x76,0x76,0x76,0x76,0x76,0x6e,0x6e,0x76,0x6e,0x6e,0x76 - ,0x76,0x76,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x76,0x76,0x24,0x24,0x6d,0x24 - ,0xbf,0xbf,0x77,0x77,0x77,0x24,0x24,0x76,0x76,0x76,0x76,0x76,0x76,0x76 - ,0x76,0x76,0x76,0x76,0x76,0x76,0x6e,0x6e,0x6d,0x6d,0x6d,0x65,0x76,0x76 - ,0x25,0x25,0x6d,0x24,0xff,0xbf,0xbf,0xbf,0xbf,0x24,0x24,0x77,0x77,0x77 - ,0x76,0x76,0x76,0x76,0x76,0x6e,0x6e,0x76,0x76,0x6e,0x6e,0x6e,0x6d,0x65 - ,0x6d,0x6d,0x76,0x76,0x25,0x65,0x6d,0x24,0xff,0xbf,0xbf,0xbf,0xbf,0x25 - ,0x24,0x77,0xb7,0x77,0x76,0x77,0x76,0x76,0x76,0x6e,0x76,0x6e,0x6e,0x6e - ,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x77,0x76,0x25,0x6d,0x6d,0x24,0xff,0xbf - ,0xbf,0xbf,0xbf,0x6d,0x65,0xbf,0xbf,0x77,0x76,0x77,0x76,0x76,0x76,0x76 - ,0x76,0x6e,0x6e,0x6e,0x76,0x6e,0x6d,0x6d,0x6d,0x6d,0x77,0x76,0x25,0x25 - ,0x25,0x24,0xff,0xbf,0xbf,0xbf,0xbf,0x6d,0x6d,0xbf,0xbf,0xbf,0x77,0x76 - ,0x76,0x76,0x76,0x6e,0x76,0x6e,0x6e,0x6e,0x76,0x6e,0x6d,0x6d,0x6d,0x6d - ,0x77,0x76,0x25,0x65,0x65,0x1c,0xff,0xbf,0xbf,0xbf,0xbf,0x6e,0x76,0xbf - ,0xff,0xff,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf - ,0xbf,0xbf,0xbf,0xbf,0x77,0xbf,0x65,0x6d,0x6d,0x1c,0xff,0xbf,0xbf,0xbf - ,0xbf,0xbf,0xbf,0xff,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf,0xbf - ,0xbf,0xbf,0xbf,0xbf,0x77,0xbf,0xbf,0xbf,0xbf,0x77,0x65,0x6d,0x65,0x1c - ,0xff,0xbf,0xbf,0x77,0xbf,0xbf,0xbf,0x77,0x76,0x76,0x76,0x76,0x76,0x76 - ,0x76,0x76,0x6e,0x76,0x6e,0x6e,0x6e,0x6e,0x6d,0x6e,0x6e,0x6d,0x6d,0x65 - ,0x6d,0x6d,0x65,0x24,0xff,0xbf,0x77,0x77,0xbf,0xbf,0xb7,0x77,0x76,0x76 - ,0x77,0x77,0x77,0x76,0x76,0x76,0x6e,0x6e,0x76,0x76,0x6e,0x6e,0x6d,0x6e - ,0x6e,0x6d,0x6d,0x65,0x6d,0x6d,0x65,0x1c,0xff,0xbf,0xbf,0xbf,0xbf,0xbf - ,0xbf,0x77,0x76,0x77,0x77,0x77,0x76,0x76,0x76,0x6e,0x6e,0x76,0x76,0x76 - ,0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x65,0x6d,0x6d,0x6d,0x1c,0xbf,0x25 - ,0x1c,0x24,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c - ,0x1c,0x1c,0x24,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c - ,0x1c,0x1c -}; - -const unsigned char image3[] = +const unsigned char texture2[] = { 32, 32 // width, height ,0x65,0x1d,0x01,0x1c,0x12,0x0a,0x01,0x13,0x14,0x6e,0x2e,0x0b,0x1c,0x1d ,0x2e,0x1d,0x13,0x0b,0x13,0x65,0x1d,0x1d,0x13,0x66,0x6f,0x6e,0x65,0x6f @@ -343,6 +265,84 @@ const unsigned char image3[] = ,0x66,0x25 }; +const unsigned char texture3[] = +{ 32, 32 // width, height + ,0xb6,0x3d,0x33,0x33,0x3e,0x33,0x2a,0x29,0x2a,0x29,0x2a,0x20,0x29,0x29 + ,0x2a,0x29,0x10,0x10,0x10,0x49,0x58,0x99,0x50,0x50,0x10,0x4b,0x54,0x54 + ,0x55,0x55,0x4a,0x49,0x29,0x3d,0x3d,0x7c,0x3d,0x33,0x34,0x3d,0x33,0x33 + ,0x33,0x20,0x20,0x29,0x10,0x20,0x10,0x50,0x10,0x49,0x10,0x99,0x51,0x51 + ,0x33,0x10,0x53,0x66,0x67,0x15,0x54,0x4b,0x7f,0x33,0x7f,0x3d,0x3e,0x3d + ,0x33,0x3d,0x29,0x29,0x2a,0x20,0x20,0x2a,0x10,0x20,0x10,0x51,0x50,0x50 + ,0x58,0x51,0x51,0x51,0x33,0x33,0x10,0x55,0x5e,0x67,0x26,0x66,0x29,0x7f + ,0x3e,0x3d,0x3d,0x33,0x3d,0x33,0x29,0x10,0x10,0x20,0x33,0x10,0x10,0x2a + ,0x58,0x59,0x50,0x10,0x51,0x51,0x10,0x51,0x52,0x37,0x37,0x10,0x10,0x5d + ,0x53,0x55,0x6c,0x3e,0x3d,0x33,0x33,0x3d,0x33,0x29,0x10,0x2a,0x20,0x20 + ,0x29,0x20,0x10,0x10,0x58,0x10,0x10,0x10,0x58,0x49,0x51,0x99,0x49,0x37 + ,0x37,0x33,0x33,0x10,0x10,0x49,0x7f,0x7f,0x33,0x3d,0x3d,0x7f,0x33,0x3e + ,0x29,0x2a,0x29,0x2a,0x29,0x2a,0x20,0x20,0x20,0x50,0x51,0x10,0x58,0x51 + ,0x51,0x99,0x49,0x00,0x33,0x10,0x10,0x10,0x10,0x10,0x3d,0x7f,0x3d,0x33 + ,0x3d,0x3d,0x33,0x2a,0x2a,0x20,0x29,0x29,0x29,0x10,0x20,0x19,0x10,0x19 + ,0x51,0x50,0x58,0x51,0x49,0x99,0x00,0x00,0x10,0x10,0x33,0x33,0x33,0x10 + ,0x3d,0x7f,0x7f,0x33,0x3e,0x33,0x33,0x33,0x29,0x20,0x33,0x2a,0x20,0x58 + ,0x58,0x19,0x19,0x51,0x10,0x51,0x59,0x51,0x51,0x51,0x00,0x10,0x10,0x00 + ,0x00,0x10,0x10,0x10,0x3d,0xb6,0x2a,0x3e,0x33,0x3d,0x33,0x3d,0x2a,0x10 + ,0x20,0x2a,0x10,0x58,0x58,0x19,0x50,0x19,0x58,0x10,0x58,0x99,0x51,0x49 + ,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x3d,0x2a,0x6c,0x3d,0x3e,0x33 + ,0x33,0x29,0x33,0x29,0x10,0x29,0x20,0x69,0x58,0x10,0x19,0x10,0x99,0x10 + ,0x58,0x99,0x49,0x99,0x51,0x00,0x00,0x00,0x10,0x10,0x10,0x53,0xb6,0x3d + ,0x6c,0x33,0x33,0x33,0x3d,0x29,0x20,0x33,0x20,0x20,0x29,0x20,0x51,0x51 + ,0x51,0x50,0x99,0x58,0x99,0x49,0x99,0x49,0x00,0x00,0x00,0x10,0x10,0x00 + ,0x00,0x53,0x29,0x3e,0x7f,0x29,0x33,0x2a,0x33,0x29,0x29,0x33,0x20,0x29 + ,0x10,0x58,0x10,0x49,0x51,0x58,0x99,0x49,0x49,0x51,0x51,0x00,0x00,0x00 + ,0x00,0x00,0x00,0x00,0x53,0x33,0x29,0x33,0x7e,0x33,0xb6,0x2a,0x33,0x29 + ,0x20,0x10,0x29,0x20,0x10,0x58,0x59,0x10,0x50,0x99,0x49,0x49,0x49,0x49 + ,0x51,0x9a,0x4b,0x53,0x53,0x4a,0x4a,0x15,0x37,0x37,0x2d,0x7c,0x3e,0x3d + ,0x7f,0x29,0x2a,0x10,0x29,0x10,0x10,0x20,0x29,0x58,0x51,0x51,0x99,0x51 + ,0x49,0x49,0x99,0x10,0x49,0x49,0x4a,0x4b,0x53,0x56,0x56,0x33,0x37,0x37 + ,0x6c,0x33,0x3d,0x3d,0x3d,0x7f,0x20,0x10,0x29,0x10,0x10,0x99,0x10,0x58 + ,0x51,0x49,0x49,0x49,0x49,0x58,0x49,0x51,0x4a,0x4b,0x4b,0x54,0x66,0x67 + ,0x67,0x33,0x10,0x10,0xb6,0x3d,0x33,0x7f,0x29,0x3d,0x33,0x33,0x29,0x29 + ,0xac,0x58,0x10,0x49,0x49,0x49,0x49,0x49,0x49,0x50,0x59,0x51,0x51,0x51 + ,0x54,0x15,0x66,0x5e,0x33,0x10,0x56,0x54,0xb6,0x3d,0x33,0x33,0x3e,0x33 + ,0x29,0x33,0x33,0x33,0x10,0x10,0x10,0x51,0x49,0x49,0x49,0x49,0x49,0x49 + ,0x58,0x50,0x50,0x49,0x4b,0x54,0x54,0x55,0x55,0x55,0x4a,0x49,0x29,0x3d + ,0x3d,0x7c,0x7f,0x6c,0x2a,0x29,0x10,0x10,0x10,0x19,0x20,0x10,0x99,0x51 + ,0x51,0x49,0x49,0x49,0x10,0x51,0x51,0x51,0x52,0x53,0x66,0x67,0x67,0x15 + ,0x54,0x4b,0x29,0x33,0x7f,0x3d,0x6c,0x29,0x33,0x20,0x29,0x10,0x20,0x20 + ,0x99,0x10,0x99,0x51,0x58,0x99,0x49,0x49,0x49,0x51,0x51,0x4b,0x4b,0x53 + ,0x55,0x5e,0x5e,0x67,0x26,0x66,0x29,0x7f,0x3e,0x3d,0x29,0x29,0x33,0x2a + ,0x2a,0x20,0x33,0x20,0x61,0x20,0x58,0x10,0x10,0x99,0x99,0x49,0x49,0x10 + ,0x51,0x52,0x4a,0x4b,0x53,0x54,0x54,0x5d,0x53,0x55,0x6c,0x7f,0x6c,0x29 + ,0x33,0x3d,0x2a,0x20,0x29,0x2a,0x10,0x2a,0x20,0x20,0x58,0x10,0x10,0x58 + ,0x99,0x51,0x51,0x49,0x99,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x54,0x54 + ,0xb6,0xb6,0x33,0x3d,0x3e,0x3e,0x2a,0x33,0x20,0x2a,0x20,0x33,0x2a,0x58 + ,0x58,0x50,0x10,0x58,0x10,0x10,0x58,0x99,0x00,0x99,0x00,0x00,0x00,0x00 + ,0x33,0x10,0x00,0x49,0xb6,0x29,0x3f,0x33,0x33,0x33,0x3d,0x33,0x20,0x2a + ,0x33,0x2a,0x29,0x58,0x99,0x10,0x50,0x10,0x10,0x10,0x10,0x99,0x51,0x00 + ,0x51,0x00,0x10,0x10,0x33,0x33,0x10,0x00,0x3d,0x6c,0x3d,0x33,0x3e,0x33 + ,0x33,0x2a,0x2a,0x2a,0x33,0x29,0x10,0x58,0x58,0x10,0x10,0x10,0x51,0x10 + ,0x50,0x99,0x51,0x51,0x00,0x00,0x00,0x10,0x10,0x37,0x37,0x10,0x7f,0xb6 + ,0x33,0x3d,0x33,0x3f,0x2a,0x33,0x2a,0x33,0x29,0x10,0x10,0x29,0x10,0x33 + ,0x10,0x50,0x49,0x10,0x51,0x51,0x51,0x51,0x51,0x00,0x00,0x00,0x00,0x33 + ,0x37,0x33,0x3d,0x2a,0x3d,0x3d,0x3e,0x33,0x33,0x2a,0x2a,0x33,0x33,0x10 + ,0x2a,0x20,0x10,0x10,0x10,0x50,0x49,0x58,0x51,0x51,0x58,0x99,0x00,0x00 + ,0x00,0x00,0x00,0x10,0x33,0x33,0x7f,0x3d,0x33,0x7f,0x3d,0x3d,0x33,0x3d + ,0x20,0x29,0x20,0x33,0x2a,0x10,0x10,0x2a,0x10,0x10,0x10,0x58,0x99,0x51 + ,0x59,0x99,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x33,0x29,0x3e,0x3d,0x3d + ,0x7c,0x3e,0x2a,0x3d,0x2c,0x2a,0x20,0x33,0x29,0x20,0x10,0x2a,0x10,0x10 + ,0x49,0x10,0x99,0x49,0x51,0x51,0x49,0x00,0x10,0x10,0x10,0x10,0x53,0x14 + ,0x29,0x33,0x7e,0x33,0x3d,0x3d,0x33,0x33,0x29,0x20,0x20,0x33,0x20,0x20 + ,0x20,0x20,0x10,0x51,0x50,0x10,0x99,0x49,0x49,0x51,0x9a,0x4b,0x53,0x53 + ,0x4a,0x15,0x56,0x54,0x2d,0x7c,0x3e,0x3d,0x3d,0x7e,0x3d,0x3d,0x2a,0x33 + ,0x10,0x29,0x2a,0x29,0x10,0x20,0x10,0x58,0x58,0x58,0x99,0x51,0x10,0x49 + ,0x49,0x4a,0x4b,0x53,0x56,0x54,0x4b,0x54,0x6c,0x33,0x3d,0x3d,0x3d,0x33 + ,0x3d,0x33,0x29,0x33,0x20,0x20,0x20,0x10,0x2a,0x10,0x50,0x99,0x58,0x58 + ,0x51,0x51,0x51,0x4a,0x4b,0x4b,0x54,0x66,0x67,0x56,0x2e,0x5e,0xb6,0x3d + ,0x33,0x7f,0x29,0x3d,0x2a,0x29,0x33,0x29,0x20,0x2a,0x10,0x10,0x2a,0x10 + ,0x10,0x50,0x10,0x50,0x59,0x51,0x51,0x51,0x51,0x54,0x15,0x66,0x5e,0x15 + ,0x56,0x54 +}; + const unsigned char sprite[] = { 32, 32 // width, height ,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff @@ -421,12 +421,14 @@ const unsigned char sprite[] = ,0xff,0xff }; +const unsigned char *textures[] = {texture1, texture2, texture3}; + inline uint8_t sampleImage(const unsigned char *image, Unit x, Unit y) { // TODO: optimize x = wrap(x,UNITS_PER_SQUARE); - y = wrap(y,UNITS_PER_SQUARE); + y = UNITS_PER_SQUARE - wrap(y,UNITS_PER_SQUARE) - 1; int32_t index = image[1] * ((image[1] * x) / UNITS_PER_SQUARE) + (image[0] * y) / @@ -579,7 +581,7 @@ inline void pixelFunc(PixelInfo pixel) if (intensity < 0) intensity = 0; - c = sampleImage(pixel.hit.type == 0 ? image2 : image,pixel.hit.textureCoord,pixel.textureCoordY); + c = sampleImage(textures[pixel.hit.type],pixel.hit.textureCoord,pixel.textureCoordY); c = addIntensity(c,intensity - 3); } else