/** WIP raycasting demo for Pokitto. Don't forget to compile with -O3! author: Miloslav "drummyfish" Ciz license: CC0 1.0 */ #define FPS 60 #define PLAYER_SPEED (UNITS_PER_SQUARE * 3) #include "general.hpp" #define LEVEL_X_RES 32 #define LEVEL_Y_RES 16 Player player; #define SPRITES 3 #define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE #define JUMP_SPEED 500 Sprite sprites[SPRITES]; const unsigned char level[] = { /* 10 12 14 16 18 20 22 24 26 28 30 0 1 2 3 4 5 6 7 8 9 11 13 15 17 19 21 23 25 27 29 31 */ 4,0,0,4,0,0,4,0,0,4,0,0,2,4,0,4,4,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2, // 0 0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0,0,1,3,2,4,0,4,0,0,0,0,0,0,0,0, // 1 0,0,0,0,0,0,0,0,0,0,0,0,2,4,0,0,0,0,1,0,0,0,0,3,0,0,0,0,0,0,0,0, // 2 0,0,4,0,0,0,0,0,0,0,0,0,2,4,4,0,3,1,1,0,2,1,2,3,0,0,1,0,1,0,0,2, // 3 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,2, // 4 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,3,0,2,2,0,0,0,0,0,0,0,0,0,2, // 5 4,0,3,1,3,1,0,2,2,2,3,2,2,2,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 6 0,0,2,0,0,0,0,0,0,4,0,0,0,0,0,0,0,2,0,0,0,0,1,2,0,3,4,0,0,0,0,0, // 7 0,0,1,0,0,0,0,0,0,4,0,0,0,0,0,0,0,2,0,0,0,0,4,0,0,0,1,0,0,2,0,0, // 8 0,0,2,0,0,0,0,0,0,2,3,2,4,0,0,0,2,2,4,1,4,0,4,4,4,3,2,0,0,4,2,2, // 9 0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,3,3,4,0,0,0,0,0,1,0,0,0,0,0,0,0,4, // 10 2,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,2,4,0,0,0,0,0,1,0,0,4,0,0,3,0,1, // 11 1,3,1,0,4,4,4,2,2,1,2,0,2,2,3,0,0,1,4,0,0,0,3,3,3,2,2,0,0,0,0,2, // 12 0,0,0,0,0,0,0,0,0,4,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1, // 13 0,0,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,4, // 14 0,0,0,0,0,0,0,0,0,4,0,0,0,0,2,0,0,4,0,0,4,0,0,1,0,3,0,3,0,3,0,1 // 15 }; const unsigned char texture1[] = { 32, 36 // width, height ,0x01,0x01,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x12,0x09,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09 ,0x0a,0x0a,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x0a,0x0a,0x12,0x12,0x12 ,0x0a,0x0a,0x12,0x0a,0x09,0x12,0x09,0x09,0x09,0x09,0x09,0x12,0x09,0x09 ,0x09,0x01,0x01,0x01,0x12,0x12,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x0a,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x0a,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x12,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x0a ,0x12,0x09,0x12,0x09,0x12,0x12,0x0a,0x09,0x12,0x09,0x12,0x12,0x12,0x1a ,0x1b,0x1b,0x12,0x12,0x12,0x09,0x09,0x12,0x09,0x09,0x12,0x12,0x09,0x09 ,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x09,0x0a,0x12,0x00,0x09,0x09,0x09 ,0x00,0x09,0x09,0x09,0x09,0x12,0x12,0x1a,0x1b,0x1a,0x12,0x12,0x09,0x09 ,0x08,0x09,0x01,0x09,0x09,0x09,0x09,0x0a,0x09,0x09,0x09,0x01,0x01,0x01 ,0x12,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x09,0x09,0x1b ,0x23,0x2c,0x7e,0x2c,0x23,0x1a,0x11,0x09,0x09,0x09,0x01,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x0a,0x09,0x09,0x00,0x00 ,0x12,0x52,0x52,0x52,0x5b,0x09,0x11,0x1b,0x24,0x34,0x7e,0x35,0x24,0x1b ,0x12,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x0a,0x09,0x09,0x09,0x09,0x01 ,0x01,0x01,0x12,0x0a,0x09,0x0a,0x00,0x00,0x12,0x7e,0x53,0x09,0x12,0x09 ,0x09,0x1a,0x1b,0x23,0x64,0x63,0x1b,0x1a,0x12,0x09,0x09,0x09,0x01,0x09 ,0x09,0x09,0x0a,0x09,0x0a,0x0a,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09 ,0x00,0x00,0x52,0x52,0x53,0x09,0x12,0x09,0x09,0x12,0x1b,0x63,0x64,0x63 ,0x1b,0x12,0x11,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09,0x00,0x00,0x12,0x7e,0x53,0x09 ,0x09,0x09,0x12,0x1b,0x2c,0x34,0x7e,0x35,0x2c,0x1b,0x12,0x09,0x09,0x00 ,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x09 ,0x09,0x09,0x00,0x00,0x12,0x53,0x53,0x09,0x12,0x09,0x12,0x1b,0x2c,0x35 ,0x7e,0x35,0x2c,0x23,0x12,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x0a,0x0a,0x09,0x00,0x00,0x53,0x12 ,0x12,0x52,0x53,0x09,0x09,0x1a,0x1b,0x63,0x64,0x63,0x1b,0x12,0x12,0x09 ,0x09,0x09,0x09,0x09,0x08,0x09,0x0a,0x0a,0x09,0x09,0x09,0x01,0x01,0x01 ,0x12,0x0a,0x09,0x09,0x00,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x09,0x12 ,0x1b,0x63,0x64,0x63,0x1b,0x1a,0x09,0x09,0x09,0x09,0x01,0x09,0x09,0x09 ,0x0a,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09,0x00,0x09 ,0x09,0x09,0x00,0x09,0x09,0x09,0x12,0x1b,0x2c,0x35,0x7e,0x35,0x2c,0x23 ,0x12,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x01 ,0x01,0x01,0x12,0x09,0x0a,0x09,0x00,0x09,0x09,0x09,0x00,0x09,0x09,0x09 ,0x12,0x1b,0x2c,0x35,0x7e,0x35,0x2c,0x23,0x12,0x09,0x09,0x09,0x00,0x09 ,0x09,0x09,0x09,0x0a,0x09,0x0a,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09 ,0x00,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x12,0x1a,0x1b,0x23,0x64,0x63 ,0x1b,0x12,0x09,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x01,0x09 ,0x09,0x09,0x09,0x12,0x1b,0x63,0x64,0x63,0x1b,0x12,0x12,0x09,0x09,0x09 ,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x0a ,0x0a,0x0a,0x00,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x12,0x1b,0x2c,0x35 ,0x7e,0x35,0x2c,0x1b,0x12,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x0a,0x0a ,0x0a,0x09,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09,0x00,0x09,0x09,0x09 ,0x00,0x09,0x09,0x09,0x12,0x1b,0x24,0x35,0x7e,0x35,0x2c,0x23,0x12,0x09 ,0x09,0x09,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x01,0x01,0x01 ,0x12,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x01,0x09,0x00,0x09,0x09,0x1a ,0x1b,0x63,0x64,0x63,0x1b,0x12,0x09,0x09,0x09,0x09,0x00,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x12,0x01,0x09 ,0x12,0x52,0x52,0x52,0x5b,0x09,0x12,0x1a,0x1b,0x23,0x64,0x63,0x1b,0x12 ,0x09,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x09,0x09,0x12,0x09,0x09,0x01 ,0x01,0x01,0x12,0x0a,0x09,0x09,0x09,0x09,0x12,0x7e,0x53,0x09,0x12,0x09 ,0x12,0x1b,0x24,0x35,0x7e,0x35,0x2c,0x23,0x12,0x09,0x09,0x09,0x01,0x09 ,0x09,0x09,0x0a,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x0a,0x09,0x09 ,0x01,0x09,0x52,0x52,0x53,0x09,0x12,0x09,0x12,0x23,0x2c,0x35,0x7e,0x35 ,0x2c,0x23,0x12,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x0a,0x09,0x09,0x09 ,0x09,0x01,0x01,0x01,0x12,0x0a,0x09,0x0a,0x01,0x09,0x12,0x7e,0x53,0x09 ,0x09,0x09,0x11,0x1a,0x1b,0x63,0x64,0x63,0x1b,0x12,0x09,0x09,0x09,0x09 ,0x01,0x09,0x09,0x09,0x0a,0x09,0x0a,0x09,0x09,0x01,0x01,0x01,0x12,0x12 ,0x09,0x0a,0x01,0x09,0x12,0x53,0x53,0x09,0x12,0x09,0x11,0x12,0x1b,0x63 ,0x64,0x63,0x1b,0x12,0x09,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x12,0x09 ,0x0a,0x09,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x12,0x01,0x09,0x53,0x12 ,0x12,0x52,0x53,0x09,0x12,0x1b,0x23,0x34,0x7e,0x2c,0x23,0x1b,0x12,0x09 ,0x09,0x09,0x01,0x09,0x09,0x09,0x09,0x09,0x12,0x09,0x09,0x01,0x01,0x01 ,0x12,0x09,0x09,0x0a,0x01,0x09,0x09,0x09,0x00,0x09,0x09,0x09,0x09,0x1a ,0x23,0x2c,0x7e,0x2c,0x23,0x1b,0x12,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x0a,0x09,0x09,0x01,0x01,0x01,0x12,0x0a,0x09,0x12,0x00,0x09 ,0x09,0x09,0x00,0x09,0x09,0x09,0x09,0x12,0x12,0x1a,0x1b,0x1b,0x12,0x12 ,0x09,0x09,0x09,0x09,0x01,0x09,0x09,0x09,0x0a,0x09,0x12,0x09,0x09,0x01 ,0x01,0x01,0x12,0x09,0x12,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x12,0x12,0x12,0x1b,0x1b,0x12,0x12,0x12,0x09,0x0a,0x09,0x09,0x09 ,0x09,0x12,0x09,0x09,0x09,0x09,0x09,0x01,0x01,0x01,0x12,0x12,0x09,0x09 ,0x0a,0x09,0x09,0x09,0x0a,0x09,0x12,0x09,0x09,0x12,0x12,0x12,0x12,0x12 ,0x12,0x12,0x12,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x12,0x09,0x09,0x09 ,0x09,0x01,0x01,0x01,0x12,0x09,0x09,0x09,0x12,0x0a,0x0a,0x12,0x12,0x0a ,0x12,0x0a,0x0a,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x0a,0x0a,0x12 ,0x0a,0x0a,0x0a,0x0a,0x0a,0x12,0x09,0x09,0x09,0x01,0x01,0x01,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x12,0x09,0x09,0x01 }; const unsigned char texture2[] = { 32, 36 // width, height ,0x00,0x09,0x08,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x11,0x09,0x11,0x11 ,0x11,0x11,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x59,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x09 ,0x09,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x51,0x51,0x59,0x51 ,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59 ,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x09,0x09,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0xb2,0x09,0x09,0x09,0x09,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09,0x00,0x09,0x08,0x00 ,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0xb3,0x19 ,0x19,0x11,0x11,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0xb3,0x09,0x09,0x00,0x09,0x08,0x08,0x00,0x09,0x09,0x11,0x11,0x59 ,0x59,0x59,0x59,0x59,0x59,0x11,0xb3,0x29,0x28,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59,0x09,0x09,0x00,0x09 ,0x08,0x08,0x00,0x09,0x09,0x11,0x11,0x59,0x59,0x59,0x59,0x59,0x09,0x11 ,0xb2,0x09,0x09,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x09,0x59,0x09,0x09,0x08,0x09,0x08,0x08,0x00,0x09,0x09,0x11 ,0x59,0x59,0x59,0x59,0x59,0x59,0x11,0x11,0x61,0x61,0x59,0x59,0x59,0x59 ,0x19,0x11,0x11,0x09,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59,0x09,0x09 ,0x00,0x09,0x08,0x08,0x00,0x09,0x09,0x11,0x11,0x09,0x09,0x09,0x09,0x11 ,0x11,0x11,0x09,0x09,0x51,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09 ,0x09,0x00,0x00,0x00,0x00,0xb3,0x09,0x09,0x08,0x09,0x08,0x09,0x00,0x09 ,0x09,0x09,0x09,0x59,0x59,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x11 ,0x09,0x09,0x09,0x09,0x08,0x09,0x08,0x09,0x11,0x59,0x09,0x08,0x08,0x08 ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08 ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x59,0x09,0x09,0x09,0x09,0x08,0x09 ,0x09,0x11,0x51,0xad,0x09,0xb2,0xac,0x72,0x72,0x71,0x69,0x61,0x61,0x59 ,0x19,0x19,0x19,0x19,0x19,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11 ,0x09,0x59,0x09,0x09,0x09,0x09,0x08,0x09,0x09,0x51,0x59,0xa5,0xa0,0x72 ,0xb4,0xb4,0xb3,0x71,0x69,0x61,0x61,0x59,0x59,0x59,0x19,0x19,0x19,0x19 ,0x11,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09,0x09,0x09 ,0x08,0x09,0x09,0x51,0x59,0xad,0x60,0x71,0xb4,0xb4,0xab,0x72,0x69,0x61 ,0x61,0x59,0x59,0x59,0x19,0x19,0x19,0x19,0x19,0x19,0x11,0x11,0x11,0x11 ,0x11,0x11,0x09,0x59,0x09,0x09,0x09,0x09,0x08,0x09,0x09,0x51,0x59,0xae ,0xa9,0xb3,0xad,0xb4,0xab,0x72,0x69,0x69,0x61,0x59,0x59,0x59,0x19,0x19 ,0x19,0x19,0x19,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09 ,0x09,0x09,0x08,0x09,0x09,0x51,0x61,0xae,0xa9,0xb4,0xad,0xb4,0xab,0x72 ,0x69,0x09,0x09,0x09,0x09,0x09,0x19,0x19,0x19,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x11,0x11,0x09,0x59,0x09,0x09,0x09,0x09,0x08,0x09,0x09,0x51 ,0x61,0xae,0xa9,0xb4,0xad,0xb4,0xac,0x72,0x69,0x11,0x61,0x59,0x59,0x09 ,0x19,0x19,0x19,0x09,0x11,0x11,0x11,0x11,0x11,0x09,0x11,0x11,0x09,0x59 ,0x09,0x09,0x09,0x09,0x08,0x09,0x09,0x51,0x61,0xae,0xa9,0x72,0x72,0x72 ,0x69,0x69,0x61,0x11,0x61,0x59,0x59,0x09,0x09,0x09,0x09,0x09,0x19,0x19 ,0x11,0x11,0x11,0x09,0x09,0x09,0x09,0x59,0x09,0x09,0x09,0x09,0x08,0x09 ,0x09,0x51,0x59,0xae,0xa9,0xb4,0xac,0xb4,0xab,0x72,0x69,0x69,0x61,0x59 ,0x11,0x19,0x28,0x11,0x11,0x19,0x19,0x19,0x11,0x11,0x11,0x11,0x11,0x11 ,0x09,0x59,0x09,0x09,0x09,0x09,0x08,0x09,0x09,0x51,0x59,0xad,0xa9,0xab ,0xac,0xab,0xab,0x72,0x69,0x69,0x61,0x59,0x11,0x19,0x28,0x11,0x11,0x19 ,0x19,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09,0x09,0x09 ,0x08,0x09,0x09,0x11,0x59,0xad,0xa0,0xb1,0xb4,0xb4,0x72,0x69,0x69,0x61 ,0x61,0x19,0x19,0x61,0x59,0x59,0x11,0x19,0x11,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x09,0x59,0x09,0x09,0x09,0x09,0x08,0x09,0x09,0x11,0x59,0xa5 ,0x60,0x71,0xb4,0xab,0x72,0x69,0x69,0x61,0x59,0x19,0x19,0x19,0x19,0x19 ,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09 ,0x09,0x09,0x08,0x09,0x09,0x11,0x51,0xad,0x09,0xb2,0xb4,0xab,0x71,0x71 ,0x69,0x61,0x59,0x19,0x19,0x19,0x19,0x19,0x11,0x11,0x19,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09,0x08,0x09,0x08,0x09,0x08,0x09 ,0x11,0x51,0x09,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08 ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x59 ,0x09,0x09,0x08,0x09,0x08,0x09,0x00,0x09,0x09,0x11,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x08,0x08,0x08,0x00,0x59,0x09,0x09,0x08,0x09,0x08,0x08 ,0x00,0x09,0x09,0x11,0x59,0x59,0x59,0x59,0x19,0x59,0x59,0x59,0x49,0x49 ,0x51,0x51,0x19,0x19,0x59,0x59,0x11,0x11,0x11,0x11,0x09,0x09,0x09,0x09 ,0x09,0x59,0x09,0x09,0x00,0x09,0x08,0x08,0x00,0x09,0x09,0x11,0x11,0x11 ,0x59,0x59,0x59,0x59,0x59,0x59,0x09,0x09,0x51,0x51,0x19,0x11,0x19,0x11 ,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59,0x09,0x09,0x00,0x09 ,0x08,0x00,0x00,0x09,0x09,0x11,0x11,0x11,0x59,0x59,0x59,0x59,0x59,0x59 ,0x09,0x09,0x51,0x09,0x11,0x11,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x11 ,0x11,0x09,0x09,0x59,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x09,0x09,0x11 ,0x11,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x09,0x09,0x11,0x09,0x19,0x11 ,0x19,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x09 ,0x00,0x09,0x08,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x00,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0xb3,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x09 ,0x09,0x11,0x11,0x11,0x19,0x19,0x19,0x11,0x59,0x11,0x09,0x09,0x11,0x09 ,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59 ,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x09,0x09,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x09,0x09,0x11,0x09,0x11,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59,0x09,0x09,0x00,0x09,0x08,0x00 ,0x00,0x09,0x09,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09 ,0x09,0x09,0x11,0x11,0x11,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x59,0x09,0x09 }; const unsigned char texture3[] = { 32, 36 // width, height ,0x08,0x08,0x64,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x64 ,0x64,0x5b,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0x6d,0x64,0x64,0x64,0x64,0x5b,0x5b,0x09,0x09,0x09,0x09 ,0x09,0x08,0x08,0x08,0x64,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x64,0x64 ,0x64,0x64,0x5b,0x5b,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x09,0x64,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0x6d,0x64,0x64,0x64,0x64,0x64,0x5b,0x00,0x09 ,0x00,0x09,0x11,0x08,0x08,0x08,0x64,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d ,0x6d,0x64,0x64,0x64,0x64,0x5b,0x00,0x00,0x00,0x09,0x09,0x08,0x08,0x08 ,0x64,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x64,0x64,0x64,0x64,0x5b ,0x00,0x09,0x00,0x09,0x09,0x08,0x08,0x08,0x64,0x09,0x09,0x12,0x12,0x12 ,0x12,0x12,0x12,0x12,0x12,0x12,0xb6,0xb6,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0x6d,0x64,0x64,0x64,0x64,0x5b,0x00,0x09,0x00,0x09,0x09,0x08 ,0x08,0x08,0x64,0x64,0x64,0x12,0x12,0x12,0x12,0x52,0x52,0x52,0x12,0xb6 ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x64,0x64,0x64 ,0x64,0x5b,0x00,0x09,0x00,0x09,0x09,0x08,0x08,0x08,0x64,0x09,0x52,0x64 ,0x64,0x5b,0x5b,0x5b,0x52,0x5b,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x64,0x5b,0x00,0x00,0x00,0x09 ,0x09,0x08,0x08,0x09,0x64,0x09,0x12,0x64,0x12,0x12,0x52,0x5b,0x12,0x52 ,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d ,0x64,0x64,0x64,0x5b,0x00,0x09,0x09,0x09,0x11,0x08,0x08,0x08,0x64,0x64 ,0x64,0x64,0x64,0x12,0x12,0x12,0x5b,0x52,0xb6,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x64,0x5b,0x09,0x09 ,0x09,0x09,0x09,0x08,0x08,0x09,0x64,0x09,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b ,0x52,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0x6d,0x6d,0x64,0x64,0x64,0x5b,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08 ,0x64,0x09,0x12,0x52,0x12,0x52,0x52,0x5b,0x12,0x5b,0x12,0xb6,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x64,0x5b ,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0x09,0x64,0x5b,0x5b,0x12 ,0x52,0x64,0x12,0x12,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0x6d,0x64,0x64,0x64,0x5b,0x09,0x09,0x09,0x09,0x11,0x08 ,0x08,0x08,0x64,0x09,0x12,0x52,0x5b,0x12,0x12,0x64,0x12,0x12,0x12,0x12 ,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x64,0x64 ,0x64,0x5b,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0x09,0x12,0x12 ,0x5b,0x64,0x12,0x52,0x5b,0x5b,0x5b,0x12,0xb6,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x64,0x5b,0x09,0x09,0x09,0x09 ,0x09,0x08,0x08,0x08,0x64,0x09,0x12,0x12,0x12,0x64,0x12,0x52,0x52,0x12 ,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d ,0x64,0x64,0x64,0x5b,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0x09 ,0x5b,0x5b,0x5b,0x64,0x12,0x52,0x12,0x12,0x12,0x12,0xb6,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x64,0x5b,0x09,0x09 ,0x09,0x09,0x09,0x08,0x08,0x09,0x64,0x09,0x5a,0x62,0x5a,0x64,0x52,0x52 ,0x5b,0x12,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0x6d,0x6d,0x64,0x64,0x52,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08 ,0x64,0x09,0x62,0xb3,0x63,0x52,0x64,0x5b,0x5b,0x12,0x12,0x12,0xb6,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x6d,0x64,0x5b,0x09 ,0x09,0x09,0x09,0x09,0x11,0x08,0x08,0x08,0x64,0x09,0x5a,0x63,0x63,0x5b ,0x64,0x52,0x52,0x52,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0x6d,0x6d,0x6d,0x64,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x08 ,0x08,0x08,0x64,0x09,0x12,0x09,0x09,0x5b,0x64,0x09,0x12,0x5b,0x12,0x12 ,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0x09,0x12,0x09 ,0x00,0x64,0x09,0x00,0x12,0x52,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x08,0x08,0x08,0x64,0x09,0x12,0x00,0x00,0x52,0x00,0x00,0x12,0x12 ,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d ,0x64,0x64,0x09,0x12,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x09,0x64,0x09 ,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x12,0x12,0x12,0xb6,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0x09,0x12,0x12,0x52,0x52,0x52,0x52 ,0x52,0x12,0x12,0x12,0xb6,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0x6d,0x6d,0x64,0x64,0x09,0x12,0x09,0x09,0x09,0x09,0x11,0x08,0x08,0x09 ,0x64,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xb6,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x6d,0x64,0x09,0x12 ,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0xb6,0xb6,0xb6,0xb6,0xb6 ,0xb6,0xb6,0xb6,0xb6,0xb6,0xb6,0xb6,0xb6,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0x6d,0x6d,0x6d,0x64,0x09,0x12,0x09,0x09,0x09,0x09,0x09,0x08 ,0x08,0x08,0x64,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0x6d,0x6d,0x64,0x64,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x08,0x08,0x08,0x64,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d ,0x64,0x64,0x5b,0x09,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x64,0xad ,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad ,0xad,0xad,0xad,0xad,0xad,0x6d,0x6d,0x6d,0x64,0x64,0x64,0x5b,0x09,0x09 ,0x09,0x09,0x11,0x08 }; const unsigned char texture4[] = { 32, 36 // width, height ,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09 ,0x09,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x11,0x11 ,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09 ,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x09,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x09,0x09,0x09,0x09,0x09,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x00,0x09,0x00,0x00 ,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x00,0x00,0x00 ,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x11,0x11,0x11 ,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x11,0x11,0x09,0x09,0x59,0x09,0x00,0x08 ,0x00,0x00,0x00,0x09,0x09,0x19,0x6c,0x63,0x63,0x63,0x63,0x63,0x63,0x5a ,0x5a,0x1a,0x12,0x09,0x52,0x09,0x08,0x08,0x08,0x5a,0x0a,0x0a,0x00,0x09 ,0x59,0x11,0x11,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x5a ,0x19,0x63,0x63,0x63,0x63,0x5b,0x5b,0x5b,0x1a,0x10,0x10,0x09,0x52,0x09 ,0x09,0x09,0x09,0x08,0x0a,0x0a,0x00,0x09,0x59,0x11,0x09,0x09,0x59,0x09 ,0x00,0x08,0x00,0x00,0x00,0x09,0x09,0x62,0x19,0x63,0x63,0x63,0x63,0x63 ,0x5b,0x5a,0x1a,0x10,0x10,0x09,0x52,0x09,0x11,0x09,0x09,0x08,0x0a,0x0a ,0x00,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09 ,0x09,0x62,0x5a,0x19,0x63,0x63,0x63,0x5b,0x5a,0x1a,0x10,0x11,0x11,0x09 ,0x52,0x09,0x11,0x11,0x09,0x09,0x08,0x0a,0x08,0x09,0x59,0x11,0x09,0x09 ,0x11,0x09,0x00,0x09,0x00,0x00,0x08,0x09,0x09,0x5a,0x5a,0x19,0x63,0x22 ,0x1a,0x1a,0x1a,0x1a,0x10,0x11,0x11,0x09,0x52,0x09,0x11,0x09,0x09,0x09 ,0x08,0x09,0x09,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00 ,0x00,0x09,0x09,0x62,0x62,0x61,0x19,0x19,0x11,0x11,0x10,0x10,0x11,0x5a ,0x52,0x09,0x52,0x09,0x11,0x09,0x09,0x09,0x0a,0x08,0x08,0x09,0x59,0x11 ,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x62,0x21,0x19 ,0x6c,0x6c,0x64,0x64,0x64,0x5a,0x10,0x5a,0x52,0x09,0x52,0x09,0x11,0x09 ,0x09,0x0a,0x08,0x08,0x08,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09 ,0x00,0x00,0x00,0x09,0x09,0x61,0x19,0x6c,0x63,0x63,0x63,0x63,0x5a,0x5a ,0x10,0x52,0x12,0x09,0x52,0x09,0x11,0x09,0x09,0x12,0x08,0x09,0x09,0x09 ,0x59,0x11,0x11,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x09 ,0x09,0x6c,0x63,0x63,0x63,0x63,0x5a,0x5a,0x5a,0x10,0x10,0x09,0x52,0x09 ,0x09,0x09,0x12,0x08,0x08,0x09,0x09,0x09,0x59,0x11,0x11,0x09,0x59,0x09 ,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x52,0x52,0x09,0x63,0x63,0x63,0x5b ,0x5a,0x5a,0x5a,0x10,0x10,0x12,0x09,0x52,0x52,0x52,0x09,0x08,0x09,0x09 ,0x09,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09 ,0x09,0x09,0x09,0x52,0x09,0x63,0x63,0x5b,0x5b,0x5a,0x5a,0x52,0x52,0x08 ,0x08,0x09,0x09,0x09,0x52,0x09,0x09,0x09,0x09,0x09,0x59,0x11,0x09,0x09 ,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x19,0x63,0x09,0x52,0x09 ,0x5b,0x63,0x5b,0x5a,0x5a,0x12,0x12,0x08,0x11,0x09,0x09,0x09,0x09,0x52 ,0x09,0x09,0x09,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00 ,0x00,0x09,0x09,0x63,0x19,0x09,0x52,0x09,0x63,0x5b,0x5a,0x5a,0x1a,0x10 ,0x08,0x11,0x12,0x11,0x09,0x09,0x09,0x52,0x09,0x09,0x09,0x09,0x59,0x11 ,0x09,0x09,0x11,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x63,0x19,0x09 ,0x52,0x09,0x63,0x63,0x5a,0x5a,0x1a,0x10,0x10,0x11,0x12,0x11,0x09,0x09 ,0x09,0x52,0x09,0x09,0x09,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09 ,0x00,0x00,0x00,0x09,0x09,0x63,0x63,0x09,0x52,0x09,0x63,0x5b,0x5b,0x1a ,0x10,0x11,0x11,0x12,0x12,0x11,0x11,0x09,0x09,0x52,0x09,0x09,0x09,0x09 ,0x59,0x11,0x11,0x09,0x59,0x09,0x00,0x08,0x00,0x00,0x00,0x09,0x09,0x63 ,0x63,0x09,0x52,0x09,0x1a,0x1a,0x1a,0x1a,0x10,0x11,0x11,0x12,0x11,0x11 ,0x09,0x09,0x09,0x52,0x09,0x09,0x09,0x09,0x59,0x11,0x09,0x09,0x59,0x09 ,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x63,0x63,0x09,0x52,0x09,0x11,0x10 ,0x11,0x11,0x11,0x52,0x12,0x12,0x11,0x11,0x11,0x09,0x09,0x52,0x09,0x08 ,0x08,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x08,0x00,0x00,0x00,0x09 ,0x09,0x63,0x63,0x09,0x52,0x09,0x64,0x64,0x64,0x5a,0x10,0x52,0x12,0x12 ,0x12,0x11,0x09,0x09,0x09,0x52,0x09,0x5a,0x5a,0x09,0x59,0x11,0x09,0x09 ,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x63,0x19,0x09,0x52,0x09 ,0x63,0x5b,0x5a,0x5a,0x10,0x52,0x12,0x12,0x11,0x11,0x11,0x09,0x09,0x52 ,0x09,0x09,0x08,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00 ,0x00,0x09,0x09,0x63,0x19,0x09,0x52,0x09,0x63,0x63,0x5a,0x5a,0x5a,0x10 ,0x10,0x12,0x52,0x12,0x12,0x12,0x09,0x52,0x09,0x09,0x00,0x09,0x59,0x11 ,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x19,0x6c,0x09 ,0x52,0x09,0x63,0x5b,0x5b,0x5a,0x5a,0x12,0x12,0x08,0x08,0x08,0x08,0x08 ,0x09,0x52,0x09,0x09,0x00,0x09,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09 ,0x00,0x00,0x00,0x09,0x09,0x19,0x63,0x09,0x52,0x09,0x63,0x63,0x5a,0x5a ,0x1a,0x10,0x08,0x63,0x63,0x63,0x5b,0x12,0x09,0x52,0x09,0x09,0x00,0x09 ,0x59,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x11,0x11,0x11,0x09,0x59,0x09 ,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x08,0x00,0x00,0x00,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x11,0x11,0x11,0x11,0x09,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09 ,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x11,0x11 ,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09 ,0x59,0x09,0x00,0x09,0x00,0x00,0x00,0x09,0x09,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x09,0x09,0x11,0x11,0x09,0x11,0x11,0x11,0x11,0x11 ,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09,0x59,0x09,0x00,0x09,0x00,0x00 ,0x00,0x09,0x09,0x09,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x09,0x09 ,0x09,0x09,0x09,0x11,0x11,0x11,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x59,0x09 }; const unsigned char sprite1[] = { 32, 32 // width, height ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x00,0x00,0x00,0x64,0x64,0x64,0x76,0x64,0x64,0x64,0x64,0x64,0x00,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x00,0x00,0x64,0x76,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07 ,0x07,0x07,0x07,0x07,0x00,0x00,0x76,0x64,0x00,0x00,0x00,0x09,0x09,0x09 ,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x52,0x76,0x76,0x64 ,0x52,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x76,0x64,0x00,0x09,0x09,0x09 ,0x09,0x09,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x52 ,0x09,0x76,0x52,0x64,0x52,0x00,0x07,0x07,0x07,0x00,0xff,0x76,0x09,0x09 ,0x52,0x09,0x52,0x09,0x09,0x52,0x09,0x00,0x07,0x07,0x07,0x07,0x07,0x07 ,0x00,0x76,0x76,0x64,0x52,0x64,0x09,0x64,0x52,0x00,0x07,0x07,0x00,0xff ,0x09,0x09,0x09,0x52,0x09,0x52,0x09,0x52,0x52,0x52,0x52,0x00,0x00,0x07 ,0x07,0x07,0x07,0x00,0x52,0x76,0x52,0x64,0x09,0x76,0x52,0x64,0x52,0x00 ,0x07,0x00,0x76,0x52,0x52,0x64,0x64,0x52,0x52,0x52,0x52,0x64,0x52,0x64 ,0x64,0x64,0x64,0x00,0x07,0x07,0x00,0x52,0x09,0x76,0x09,0x64,0x52,0x76 ,0x09,0x64,0x52,0x00,0x00,0x76,0x64,0x00,0x00,0x00,0x00,0x00,0x64,0x52 ,0x52,0x52,0x52,0x52,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x52,0x09,0x64 ,0x52,0x64,0x52,0x76,0x52,0x64,0x52,0x00,0x00,0xff,0x00,0x07,0x07,0x07 ,0x07,0x07,0x00,0x64,0x52,0x52,0x52,0x00,0x00,0x00,0x07,0x07,0x07,0x07 ,0x00,0x00,0x09,0x76,0x09,0x64,0x09,0x64,0x52,0x52,0x52,0x00,0x07,0x00 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x64,0x52,0x00,0x00,0x76,0x76 ,0x00,0x07,0x07,0x07,0x00,0x64,0x09,0x76,0x52,0x64,0x09,0x76,0x09,0x52 ,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x07,0x00,0x64,0x09 ,0x00,0x76,0x64,0x00,0x00,0x07,0x07,0x07,0x00,0x52,0x00,0x76,0x09,0x52 ,0x09,0x64,0x52,0x64,0x52,0x00,0x07,0x00,0x07,0x07,0x00,0x64,0x76,0x64 ,0x00,0x07,0x00,0x09,0x76,0x64,0x76,0x00,0x76,0x00,0x07,0x00,0x64,0x64 ,0x09,0x64,0x52,0x64,0x09,0x76,0x52,0x64,0x52,0x00,0x00,0xff,0x00,0x00 ,0x76,0x00,0x00,0x64,0x64,0x00,0x52,0x52,0x64,0x00,0x00,0x76,0x64,0x64 ,0x00,0x64,0x00,0x00,0x09,0x76,0x09,0x64,0x09,0x76,0x52,0x52,0x52,0x00 ,0x07,0x00,0x76,0x76,0x00,0x07,0x07,0x00,0x64,0x00,0x09,0x64,0x52,0x64 ,0x64,0x64,0x00,0x00,0x64,0x00,0x00,0x52,0x09,0x64,0x09,0x52,0x00,0x76 ,0x09,0x64,0x52,0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x07,0x00,0x64,0x52 ,0x64,0x52,0x52,0x64,0x64,0x00,0x07,0x07,0x00,0x07,0x00,0x52,0x09,0x64 ,0x52,0x52,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x07,0x00,0x00,0x07,0x07 ,0x07,0x00,0x64,0x52,0x64,0x52,0x52,0x52,0x64,0x00,0x07,0x07,0x00,0x07 ,0x00,0x52,0x00,0x64,0x09,0x64,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x00 ,0x64,0x64,0x00,0x07,0x07,0x00,0x52,0x00,0x09,0x64,0x52,0x52,0x52,0x64 ,0x00,0x00,0x64,0x00,0x00,0x09,0x00,0x76,0x09,0x52,0x00,0x76,0x09,0x52 ,0x52,0x00,0x00,0x64,0x00,0x00,0x64,0x00,0x00,0x52,0x64,0x00,0x52,0x52 ,0x64,0x00,0x00,0x64,0x64,0x64,0x00,0x64,0x00,0x00,0x00,0x64,0x09,0x52 ,0x00,0x64,0x52,0x52,0x52,0x00,0x07,0x00,0x07,0x07,0x00,0x52,0x64,0x52 ,0x00,0x07,0x00,0x09,0x64,0x64,0x64,0x00,0x64,0x00,0x07,0x00,0x64,0x64 ,0x00,0x64,0x09,0x52,0x00,0x64,0x09,0x64,0x52,0x00,0x07,0x07,0x07,0x07 ,0x07,0x00,0x00,0x00,0x07,0x00,0x64,0x00,0x00,0x64,0x52,0x00,0x00,0x07 ,0x07,0x07,0x00,0x52,0x09,0x64,0x52,0x52,0x00,0x64,0x52,0x52,0x52,0x00 ,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x64,0x00,0x00,0x00 ,0x64,0x64,0x00,0x07,0x07,0x07,0x00,0x64,0x00,0x64,0x09,0x52,0x00,0x52 ,0x09,0x52,0x52,0x00,0x00,0x64,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x64 ,0x00,0x00,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x52 ,0x52,0x52,0x00,0x64,0x09,0x52,0x52,0x00,0x00,0x64,0x64,0x00,0x00,0x00 ,0x00,0x00,0x64,0x00,0x00,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x07,0x07 ,0x00,0x00,0x00,0x64,0x09,0x52,0x00,0x52,0x09,0x52,0x52,0x00,0x07,0x00 ,0x64,0x00,0x09,0x52,0x52,0x52,0x09,0x09,0x52,0x09,0x52,0x52,0x52,0x52 ,0x52,0x00,0x00,0x07,0x00,0x09,0x00,0x52,0x09,0x52,0x00,0x52,0x52,0x52 ,0x52,0x00,0x07,0x07,0x00,0x64,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09 ,0x09,0x09,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x09,0x64,0x52,0x52 ,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x07,0x07,0x00,0x64,0x64,0x00,0x09 ,0x09,0x52,0x09,0x09,0x09,0x09,0x52,0x00,0x00,0x07,0x07,0x07,0x07,0x07 ,0x00,0x52,0x52,0x52,0x00,0x52,0x09,0x52,0x52,0x00,0x07,0x07,0x07,0x07 ,0x00,0x00,0x64,0x64,0x09,0x09,0x09,0x52,0x09,0x52,0x09,0x00,0x00,0x00 ,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x64,0x52,0x52,0x52,0x00 ,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x64,0x64,0x09,0x09,0x52,0x09 ,0x52,0x09,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x09,0x52 ,0x52,0x52,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00 ,0x64,0x64,0x64,0x09,0x09,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x07,0x07 ,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x64,0x64,0x64,0x64,0x64,0x64,0x64 ,0x64,0x64,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07 }; const unsigned char sprite2[] = { 32, 32 // width, height ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0xbf,0xbf ,0xbf,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x27,0x00,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x00,0xbf,0x5b,0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0x27,0x27 ,0x0c,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x00,0x52,0x6d,0x5b,0x09,0x0c,0x0c,0x0c,0x27,0x27 ,0x27,0x0c,0x0a,0x0a,0x0a,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x00,0x07,0x00,0x5b,0x09,0x09,0x09,0x0a,0x0a ,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0b,0x0b,0x0a,0x00,0x07,0x07,0x00,0x00 ,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x3f,0x00,0x5b,0x09,0x5b ,0x09,0x00,0x02,0x01,0x01,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x00 ,0x00,0x07,0x00,0x3e,0xb6,0x00,0x07,0x00,0x07,0x07,0x07,0x00,0x15,0x15 ,0x3d,0x09,0x09,0x09,0x00,0x01,0x01,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x01 ,0x01,0x01,0x01,0x52,0x52,0x00,0x07,0x00,0x3e,0x6d,0x00,0xb6,0x00,0x07 ,0x00,0x0c,0x0c,0x15,0x15,0x3d,0x00,0x00,0x0a,0x0a,0x00,0x00,0x00,0x01 ,0x01,0x01,0x01,0x01,0x01,0x01,0x52,0x6d,0x52,0x00,0x07,0x07,0x00,0x3d ,0x5b,0x6d,0x00,0x00,0x27,0x27,0x0c,0x0c,0x15,0x3f,0x00,0x01,0x00,0x00 ,0x09,0x00,0x52,0x00,0x09,0x00,0x00,0x00,0x01,0x01,0x09,0xb6,0x09,0x00 ,0x07,0x07,0x07,0x00,0x3d,0x09,0x00,0x0a,0x0c,0x15,0x27,0x09,0x09,0x09 ,0x09,0x00,0x3f,0x00,0x52,0x09,0x64,0x00,0x3d,0x3d,0x3f,0x64,0x64,0x09 ,0xb6,0x6d,0x09,0x00,0x07,0x07,0x00,0xbf,0x6d,0x00,0x5b,0x52,0x0a,0x09 ,0x09,0x09,0x5b,0x6d,0x09,0x5b,0x3d,0x00,0x64,0x00,0x64,0x09,0x00,0x1d ,0x3f,0x5b,0x52,0x52,0x09,0x52,0x00,0x00,0x07,0x00,0xb6,0xff,0x3e,0x00 ,0x3e,0x3e,0x3d,0x09,0x5b,0x6d,0xbf,0xb6,0x52,0x3e,0x1d,0x3d,0x00,0x64 ,0x00,0x52,0x00,0x00,0x09,0x52,0x52,0x12,0x09,0x00,0x00,0x00,0x00,0x3d ,0x3d,0x3d,0x00,0x00,0x00,0x00,0x09,0x09,0x09,0x6d,0x6d,0x52,0x52,0x3e ,0x1d,0x3d,0x00,0x64,0x00,0x52,0x00,0x02,0x00,0x00,0x09,0x00,0x00,0x01 ,0x00,0x00,0x07,0x00,0x52,0x5b,0x3d,0x00,0x3d,0x3f,0x3f,0x09,0x5b,0x52 ,0x5b,0x6d,0x52,0x3d,0x1d,0x3f,0x00,0x64,0x00,0x52,0x00,0x01,0x01,0x01 ,0x01,0x0a,0x0a,0x0a,0x00,0x00,0x07,0x07,0x00,0x52,0x5b,0x00,0x52,0x52 ,0x0a,0x27,0x09,0x09,0x09,0x09,0x52,0x5b,0x3f,0x00,0x00,0x64,0x00,0x52 ,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x07,0x07,0x07,0x07,0x00 ,0x3f,0x09,0x00,0x0a,0x0c,0x27,0x0c,0x15,0x3f,0x09,0x09,0x09,0x3f,0x00 ,0x64,0x00,0x52,0x09,0x00,0x3d,0x3f,0x5b,0x00,0x00,0x01,0x01,0x00,0x07 ,0x07,0x07,0x00,0x1d,0x52,0x5b,0x00,0x0c,0x27,0x0c,0x0c,0x15,0x0c,0x3d ,0x00,0x00,0x00,0x00,0x52,0x09,0x00,0x00,0x3f,0x3e,0x3d,0x52,0x52,0x64 ,0x09,0x52,0x00,0x00,0x07,0x00,0x1d,0x5b,0x00,0x5b,0x00,0x27,0x0c,0x0c ,0x15,0x15,0x15,0x3d,0x52,0x52,0x0a,0x52,0xbf,0x6d,0x00,0x00,0x00,0x3f ,0x52,0x12,0x12,0x09,0x64,0xb6,0x52,0x00,0x00,0x3f,0x5b,0x00,0x07,0x00 ,0x07,0x00,0x00,0x0c,0x27,0x15,0x15,0x3e,0x00,0x09,0x52,0xbf,0x6d,0x5b ,0x0a,0x0a,0x0a,0x01,0x00,0x00,0x00,0x00,0x00,0x64,0x09,0x00,0x00,0x00 ,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x27,0x3e,0x27,0x27,0x15 ,0x09,0x00,0x00,0x0a,0x0a,0x0a,0x0a,0x0a,0x01,0x01,0x01,0x00,0x00,0x09 ,0x09,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00 ,0x3d,0x0c,0x0c,0x27,0x27,0x27,0x27,0x15,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a ,0x01,0x01,0x01,0x0a,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x27,0x27,0x27 ,0x27,0x15,0x15,0x0a,0x0a,0x0a,0x0a,0x0a,0x00,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,0x15,0x15,0x00,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00 ,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x07 }; const unsigned char *textures[] = {texture1, texture2, texture3, texture4}; Unit floorHeightAt(int16_t x, int16_t y) { if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES) return level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] == 0 ? 0 : UNITS_PER_SQUARE * 2; return UNITS_PER_SQUARE * 2; } Unit textureAt(int16_t x, int16_t y) { if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES) return max(level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x] - 1,0); return 0; } uint8_t cFloor, cCeiling; /** Function for drawing a single pixel (like fragment shader). */ inline void pixelFunc(PixelInfo pixel) { if (pixel.position.y == MIDDLE_ROW) zBuffer[pixel.position.x] = pixel.depth; uint8_t c = 0; if (pixel.isWall) { c = sampleImage(textures[pixel.hit.type],pixel.hit.textureCoord,pixel.textureCoordY); c = addIntensity(c, 1 - pixel.depth / (UNITS_PER_SQUARE * 2) + (pixel.hit.direction % 2 == 0 ? 2 : 0)); } else c = pixel.isFloor ? cFloor: cCeiling; uint8_t *buf = pokitto.display.screenbuffer; buf += pixel.position.x * SUBSAMPLE; buf += pixel.position.y * pokitto.display.width; for (uint8_t i = 0; i < SUBSAMPLE - 1; ++i) *buf++ = c; *buf = c; } void draw() { RayConstraints c; c.maxHits = 1; c.maxSteps = 20; c.computeTextureCoords = 1; render(player.mCamera,floorHeightAt,0,textureAt,pixelFunc,c); Unit previousDepth; /* // draw sprites for (uint8_t i = 0; i < SPRITES; ++i) { if (dist(sprites[i].mPosition,player.mCamera.position) > SPRITE_MAX_DISTANCE) continue; PixelInfo pos = mapToScreen(sprites[i].mPosition,sprites[i].mHeight,player.mCamera); if (pos.depth > 0) drawSprite(sprites[i].mImage,pos.position.x * SUBSAMPLE,pos.position.y, pos.depth,perspectiveScale(sprites[i].mPixelSize,pos.depth)); if (i != 0 && pos.depth > previousDepth) { Sprite tmp = sprites[i]; sprites[i] = sprites[i - 1]; sprites[i - 1] = tmp; } previousDepth = pos.depth; } */ /* pokitto.display.setColor(rgbToIndex(7,7,3)); pokitto.display.setCursor(1,1); pokitto.display.print(player.mCamera.position.x); pokitto.display.print(" "); pokitto.display.print(player.mCamera.position.y); pokitto.display.print(" "); pokitto.display.print(player.mCamera.direction); */ } int main() { initGeneral(); cFloor = rgbToIndex(0,1,1); cCeiling = rgbToIndex(1,0,1); player.setPositionSquare(6,5); player.mCamera.height = CAMERA_COLL_HEIGHT_BELOW; sprites[0] = Sprite(sprite1,10,5,1,100); sprites[1] = Sprite(sprite1,14,5,1,100); sprites[2] = Sprite(sprite2,15,19,1,150); sprites[2].mHeight -= UNITS_PER_SQUARE / 2; uint32_t previousTime = 0; uint32_t dt; while (pokitto.isRunning()) { if (pokitto.update()) { draw(); uint32_t timeNow = pokitto.getTime(); dt = timeNow - previousTime; previousTime = timeNow; int16_t horizontalStep = (dt * PLAYER_SPEED) / 1000; int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000; Vector2D d = angleToDirection(player.mCamera.direction); Vector2D moveOffset; moveOffset.x = 0; moveOffset.y = 0; d.x = (d.x * horizontalStep) / UNITS_PER_SQUARE; d.y = (d.y * horizontalStep) / UNITS_PER_SQUARE; if (d.x == 0 && d.y == 0) { d.x = d.x > 0 ? horizontalStep : -1 * horizontalStep; d.y = d.y > 0 ? horizontalStep : -1 * horizontalStep; } bool strafe = pokitto.aBtn(); if (pokitto.upBtn()) { moveOffset = d; } else if (pokitto.downBtn()) { moveOffset.x = -1 * d.x; moveOffset.y = -1 * d.y; } int addition = 0; if (pokitto.rightBtn()) addition = 1; else if (pokitto.leftBtn()) addition = -1; if (strafe) { d = angleToDirection(player.mCamera.direction + UNITS_PER_SQUARE / 4); d.x = (d.x * horizontalStep * addition) / UNITS_PER_SQUARE; d.y = (d.y * horizontalStep * addition) / UNITS_PER_SQUARE; moveOffset = d; } else player.mCamera.direction += addition * rotationStep; Unit prevHeight = player.mCamera.height; moveCameraWithCollision(&player.mCamera,moveOffset,0, floorHeightAt, 0, 0); Unit heightDiff = player.mCamera.height - prevHeight; } } return 0; }