2 Raycasting SDL test. This is a port of my Pokitto demo.
11 //#define RAYCAST_TINY
13 //#define RCL_USE_DIST_APPROX 2
15 // redefine some parameters
17 #define GRAVITY_ACCELERATION (RCL_UNITS_PER_SQUARE * 3)
18 #define PLAYER_JUMP_SPEED 700
19 #define RCL_CAMERA_COLL_HEIGHT_BELOW ((3 * RCL_UNITS_PER_SQUARE) / 2)
20 #define RCL_HORIZONTAL_FOV (RCL_UNITS_PER_SQUARE / 5)
21 #define RCL_VERTICAL_FOV RCL_UNITS_PER_SQUARE // redefine camera vertical FOV
23 #define RCL_PIXEL_FUNCTION pixelFunc
25 #include "raycastlib.h"
27 #define LEVEL_X_RES 29
28 #define LEVEL_Y_RES 21
30 #define SCREEN_WIDTH 640
31 #define SCREEN_HEIGHT 480
32 #define MIDDLE_ROW (SCREEN_HEIGHT / 2)
34 #define TRANSPARENT_COLOR 0b00000111
36 #define max(a,b) ((a) > (b) ? (a) : (b))
50 unsigned long frame
= 0;
52 RCL_Unit zBuffer
[SCREEN_WIDTH
]; ///< 1D z-buffer for visibility determination.
56 uint32_t pixels
[SCREEN_WIDTH
* SCREEN_HEIGHT
];
57 uint32_t pixelCounter
[SCREEN_WIDTH
* SCREEN_HEIGHT
];
61 unsigned char *mImage
;
62 RCL_Vector2D mPosition
;
67 uint32_t palette
[256];
70 #define SPRITE_MAX_DISTANCE 5 * RCL_UNITS_PER_SQUARE
72 Sprite sprites
[SPRITES
];
74 /// For each level square says the texture index.
75 const unsigned char levelTexture
[] =
77 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
78 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 3, 3, 2, 2, 2, 2, // 0 20
79 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 1, 1, 2, // 1 19
80 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, 1, 1, 1, 2, // 2 18
81 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 1, 1, 2, // 3 17
82 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, // 4 16
83 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 1, 1, 2, // 5 15
84 1, 0, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, // 6 14
85 1, 0, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, // 7 13
86 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, // 8 12
87 1, 1, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, // 9 11
88 1, 1, 1, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, // 10 10
89 1, 1, 1, 1, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, // 11 9
90 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, // 12 8
91 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, // 13 7
92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // 14 6
93 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, // 15 5
94 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, // 16 4
95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, // 17 3
96 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, // 18 2
97 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, // 19 1
98 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 // 20 0
101 /// For each level square says the floor height.
102 const signed char levelFloor
[] =
104 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
105 40,40,40,40,40,40,40,40,48,40,48,40,40,40,40,40,40,48,40,48,40,48,40,48,48,24,24,26,28, // 0 20
106 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,40, 2, 2, 2,40,32,32,32,32,32,32,32,48, 2, 2, 2,26, // 1 19
107 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,40, 2, 2, 2,40, 0, 0, 0, 0, 0,32,32,40, 2, 2, 2,26, // 2 18
108 40,16,12, 8, 4, 0,48, 0, 0, 0, 0, 0,24, 2,24, 8,24, 0, 0, 9, 9, 0,28,32,48, 2, 2, 2,24, // 3 17
109 40,20,48,48,48,48,48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0,24,32,40, 0, 0, 0,24, // 4 16
110 40,24,48,40,40,40,40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,32,48, 0, 0, 0,24, // 5 15
111 40,28,32,32,32,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8,12,16,32,40, 0, 0, 0,24, // 6 14
112 40,32,32,32,32,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,32,32,32,32,32,48, 0, 0, 0,24, // 7 13
113 40, 0,48,40,40,40,40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,-3,-8,-8,-5,-2, 0, 0, 0, 0,24, // 8 12
114 40, 0,-3,-8,-8,-8,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,-3,-8,-8, 0, 0, 0, 0, 0, 0,24, // 9 11
115 40, 0,-6,-8,-8,-8,32, 0, 0, 0,48,48, 0,48,48, 0, 0,36,32,36,-8,-8, 0, 0, 0, 0, 0, 0,24, // 10 10
116 40, 0,48,-8,-8,-8,32,32,32,32,40, 1, 0, 1,40,32,32,32,32,32,-8,-8, 0, 0, 0, 0, 0, 0,24, // 11 9
117 40, 0,48,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0,-8,-8,-8,36,32,36,-8,-8, 0, 0, 0, 0, 0, 0,24, // 12 8
118 40, 0,48,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0, 0, 0, 0,24, // 13 7
119 40, 0,48, 0,-2,-2, 0,-8,-8,-8,-8, 0, 0, 0,-8,-8, 0, 0, 0, 0, 0, 0, 0, 0,24,24,10,24,24, // 14 6
120 40, 0, 0, 0,-2,-2, 0, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0,24, // 15 5
121 40, 0, 0, 0,-2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0,24, // 16 4
122 40,24,48,-2,-2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, // 17 3
123 0,24,48,48,-2,-2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, // 18 2
124 0,24,48,48,48,-2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0,24, // 19 1
125 0,24,24,24,32,32,32,27,24,27,30,34,36,38,36,34,36,34,34,32,32,33,37,39,24,24,24,24,24 // 20 0
128 #define XX 127 // helper to keep a big number two-characters, for formatting
130 /// For each level square says the ceiling height.
131 const signed char levelCeiling
[] =
133 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
134 40,40,40,40,40,40,40,XX
,XX
,XX
,XX
,36,40,40,40,40,40,36,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 0 20
135 40,50,50,50,45,40,20,XX
,XX
,XX
,XX
,36,40,30,30,30,XX
,36,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 1 19
136 40,50,50,50,45,40,20,XX
,XX
,XX
,XX
,36,40,30,30,30,XX
,36,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 2 18
137 40,50,50,50,45,40,48,XX
,XX
,XX
,XX
,36,24,24,24,24,24,36,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 3 17
138 40,50,48,48,48,48,47,XX
,XX
,XX
,XX
,36,36,36,36,36,36,36,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 4 16
139 40,50,48,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 5 15
140 40,50,48,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 6 14
141 40,50,48,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 7 13
142 40,50,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 8 12
143 40,40,16,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 9 11
144 40,30,16,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 10 10
145 40,25,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 11 9
146 40,20,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
, // 12 8
147 40,18,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,24,24,24,24, // 13 7
148 40,18,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,24,24,24,24, // 14 6
149 40,18,16,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,25,27,29,24, // 15 5
150 40,18,16,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,25,27,29,24, // 16 4
151 40,24,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,25,27,29,24, // 17 3
152 XX
,24,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,25,27,29,24, // 18 2
153 XX
,24,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,25,27,29,24, // 19 1
154 XX
,24,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,XX
,24,24,24,24,24,24 // 20 0
159 const unsigned char texture1
[] =
160 { 32, 32 // width, height
161 ,0x12,0x65,0x65,0x6d,0x24,0x64,0x5b,0x12,0x12,0x64,0x5b,0x5b,0x12,0x51
162 ,0x12,0x09,0x00,0x6d,0x6d,0x6d,0x24,0x5b,0x5b,0x52,0x12,0x5b,0x52,0x5b
163 ,0x12,0x5b,0x52,0x09,0x12,0x5b,0x5b,0x5b,0x52,0x5b,0x5b,0x52,0x00,0x64
164 ,0x64,0x52,0x52,0x52,0x5b,0x00,0x09,0x6d,0x5b,0x5a,0x5b,0x5b,0x5a,0x51
165 ,0x12,0x64,0x5b,0x52,0x5b,0x52,0x5b,0x08,0x12,0x24,0x5b,0x5b,0x5b,0x5b
166 ,0x09,0x11,0x00,0x64,0x5b,0x5b,0x5a,0x09,0x09,0x08,0x00,0x5b,0x5b,0x5b
167 ,0x5a,0x64,0x12,0x51,0x00,0x64,0x5b,0x52,0x52,0x11,0x09,0x09,0x12,0x24
168 ,0x5b,0x5b,0x52,0x5a,0x12,0x09,0x00,0x5b,0x52,0x09,0x12,0x09,0x09,0x09
169 ,0x00,0x24,0x5a,0x5a,0x5b,0x51,0x12,0x08,0x09,0x25,0x5b,0x52,0x5b,0x52
170 ,0x11,0x09,0x12,0x64,0x5b,0x52,0x09,0x11,0x12,0x09,0x00,0x12,0x00,0x12
171 ,0x00,0x00,0x00,0x08,0x09,0x64,0x5b,0x51,0x12,0x11,0x12,0x08,0x09,0x64
172 ,0x5a,0x5b,0x12,0x12,0x09,0x09,0x12,0x65,0x5c,0x52,0x5a,0x5b,0x51,0x09
173 ,0x00,0x64,0x6d,0x6d,0x5c,0x65,0x64,0x09,0x00,0x24,0x64,0x5b,0x09,0x12
174 ,0x11,0x00,0x09,0x64,0x5b,0x52,0x52,0x12,0x12,0x08,0x00,0x64,0x52,0x52
175 ,0x52,0x52,0x5b,0x09,0x00,0x6d,0x5b,0x5b,0x52,0x5b,0x51,0x09,0x00,0x1b
176 ,0x5b,0x12,0x12,0x12,0x12,0x09,0x12,0x5b,0x11,0x09,0x11,0x09,0x09,0x09
177 ,0x09,0x5b,0x09,0x09,0x09,0x09,0x09,0x09,0x12,0x65,0x5b,0x5b,0x5b,0x52
178 ,0x5b,0x09,0x00,0x64,0x12,0x63,0x5b,0x12,0x5b,0x09,0x00,0x00,0x00,0x00
179 ,0x00,0x09,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5b
180 ,0x64,0x5b,0x09,0x5b,0x52,0x09,0x09,0x5b,0x11,0x52,0x09,0x12,0x09,0x08
181 ,0x00,0x1b,0x1b,0x23,0x1b,0x5a,0x5b,0x11,0x12,0x64,0x64,0x6d,0x24,0x5b
182 ,0x5b,0x09,0x00,0x5b,0x5a,0x52,0x52,0x09,0x08,0x09,0x12,0x5b,0x52,0x11
183 ,0x5a,0x11,0x12,0x08,0x08,0x1b,0x52,0x52,0x5b,0x5a,0x09,0x09,0x12,0x64
184 ,0x5b,0x64,0x12,0x12,0x12,0x08,0x00,0x00,0x00,0x12,0x09,0x00,0x09,0x00
185 ,0x12,0x24,0x5a,0x52,0x12,0x12,0x12,0x08,0x12,0x1b,0x12,0x5a,0x49,0x5a
186 ,0x52,0x09,0x12,0x6d,0x5b,0x52,0x5a,0x12,0x09,0x09,0x12,0x65,0x64,0x6d
187 ,0x6d,0x64,0x64,0x5b,0x00,0x5a,0x08,0x08,0x09,0x09,0x08,0x09,0x00,0x5b
188 ,0x5a,0x11,0x51,0x51,0x5a,0x09,0x12,0x6d,0x5b,0x5b,0x12,0x11,0x12,0x09
189 ,0x00,0x65,0x5b,0x64,0x5b,0x5b,0x5b,0x52,0x00,0x00,0x12,0x12,0x12,0x09
190 ,0x00,0x00,0x00,0x5a,0x52,0x52,0x09,0x52,0x09,0x09,0x12,0x63,0x5b,0x5a
191 ,0x09,0x5b,0x11,0x08,0x00,0x65,0x5b,0x5b,0x52,0x5b,0x52,0x52,0x00,0x65
192 ,0x6d,0x64,0x65,0x64,0x64,0x5b,0x00,0x5b,0x12,0x09,0x11,0x09,0x09,0x09
193 ,0x09,0x5b,0x11,0x08,0x09,0x09,0x09,0x08,0x00,0x64,0x64,0x5b,0x5b,0x5b
194 ,0x5b,0x09,0x00,0x5b,0x5b,0x5b,0x5b,0x5b,0x52,0x52,0x00,0x64,0x51,0x52
195 ,0x52,0x52,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x5b
196 ,0x5b,0x5b,0x52,0x52,0x5b,0x09,0x12,0x65,0x5b,0x5b,0x5b,0x52,0x5b,0x09
197 ,0x00,0x63,0x5a,0x51,0x51,0x51,0x5a,0x08,0x12,0x24,0x64,0x65,0x24,0x64
198 ,0x64,0x5b,0x00,0x5b,0x5b,0x52,0x5b,0x5b,0x52,0x09,0x00,0x64,0x5b,0x5b
199 ,0x12,0x52,0x5a,0x09,0x12,0x24,0x52,0x52,0x09,0x52,0x52,0x08,0x12,0x64
200 ,0x64,0x5b,0x5b,0x5b,0x64,0x52,0x00,0x6d,0x5b,0x52,0x5b,0x52,0x52,0x08
201 ,0x00,0x5b,0x5b,0x52,0x52,0x5b,0x52,0x09,0x00,0x1b,0x52,0x51,0x5a,0x52
202 ,0x09,0x09,0x12,0x64,0x52,0x5c,0x5b,0x64,0x5b,0x51,0x09,0x6d,0x5b,0x52
203 ,0x5b,0x52,0x11,0x09,0x00,0x64,0x5a,0x64,0x5b,0x52,0x5b,0x08,0x00,0x11
204 ,0x09,0x49,0x08,0x09,0x00,0x09,0x00,0x64,0x64,0x5b,0x52,0x5b,0x5b,0x09
205 ,0x12,0x65,0x64,0x5b,0x52,0x5b,0x52,0x09,0x12,0x64,0x64,0x64,0x52,0x09
206 ,0x5c,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x64,0x5b,0x64
207 ,0x52,0x5b,0x52,0x49,0x00,0x64,0x5b,0x52,0x52,0x5b,0x51,0x09,0x09,0x5b
208 ,0x09,0x09,0x09,0x08,0x09,0x12,0x00,0x6d,0x24,0x6d,0x24,0x64,0x64,0x5b
209 ,0x00,0x64,0x63,0x5b,0x5b,0x52,0x52,0x09,0x12,0x64,0x5b,0x5b,0x52,0x11
210 ,0x5b,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x12,0x6d,0x64,0x5b
211 ,0x52,0x64,0x5b,0x52,0x12,0x6d,0x5b,0x5b,0x5b,0x5b,0x5b,0x09,0x00,0x64
212 ,0x11,0x5a,0x52,0x5b,0x52,0x09,0x00,0x5b,0x5a,0x63,0x5a,0x23,0x12,0x00
213 ,0x12,0x6d,0x5b,0x11,0x5b,0x64,0x64,0x52,0x12,0x63,0x5b,0x5b,0x5b,0x5b
214 ,0x52,0x08,0x00,0x5c,0x52,0x5b,0x5b,0x52,0x52,0x08,0x08,0x5b,0x52,0x51
215 ,0x09,0x52,0x5a,0x09,0x00,0x6d,0x52,0x11,0x52,0x5b,0x52,0x09,0x12,0x64
216 ,0x5a,0x5b,0x52,0x5b,0x5b,0x08,0x00,0x5b,0x52,0x09,0x09,0x09,0x09,0x09
217 ,0x09,0x24,0x52,0x09,0x12,0x09,0x52,0x08,0x00,0x5b,0x5a,0x52,0x12,0x5b
218 ,0x5b,0x09,0x00,0x65,0x52,0x5b,0x5b,0x52,0x11,0x09,0x09,0x00,0x00,0x00
219 ,0x00,0x12,0x00,0x08,0x00,0x5b,0x52,0x51,0x09,0x09,0x09,0x09,0x00,0x64
220 ,0x5b,0x52,0x52,0x09,0x5b,0x09,0x12,0x6d,0x5b,0x5b,0x5b,0x5b,0x5a,0x11
221 ,0x00,0x6d,0x6d,0x24,0x64,0x64,0x5b,0x5b,0x00,0x5a,0x12,0x52,0x12,0x09
222 ,0x12,0x08,0x00,0x5b,0x12,0x09,0x09,0x09,0x08,0x09,0x00,0x64,0x5b,0x5b
223 ,0x52,0x5a,0x5b,0x09,0x12,0x6d,0x64,0x5a,0x5b,0x5b,0x5b,0x5b,0x00,0x5a
224 ,0x11,0x52,0x09,0x12,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x12,0x12,0x12
225 ,0x12,0x64,0x52,0x5b,0x5b,0x5b,0x5b,0x09,0x12,0x6d,0x12,0x5b,0x12,0x52
226 ,0x5b,0x52,0x09,0x5a,0x09,0x51,0x09,0x09,0x09,0x09,0x09,0x5c,0x64,0x6d
227 ,0x1b,0x24,0x64,0x08,0x12,0x64,0x5b,0x52,0x5b,0x5b,0x52,0x09,0x00,0x5b
228 ,0x5b,0x52,0x11,0x5b,0x12,0x09,0x08,0x5b,0x5a,0x09,0x51,0x52,0x12,0x08
229 ,0x00,0x5b,0x5b,0x11,0x5b,0x5b,0x5b,0x08,0x09,0x5b,0x12,0x52,0x52,0x09
230 ,0x09,0x09,0x00,0x6d,0x5b,0x52,0x52,0x12,0x12,0x09,0x08,0x11,0x00,0x49
231 ,0x09,0x00,0x09,0x00,0x00,0x6d,0x12,0x5b,0x52,0x5b,0x52,0x09,0x00,0x00
232 ,0x09,0x09,0x12,0x00,0x12,0x00,0x00,0x64,0x52,0x5b,0x52,0x5b,0x52,0x09
233 ,0x09,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x64,0x52,0x5b,0x5b,0x52
237 const unsigned char texture2
[] =
238 { 32, 32 // width, height
239 ,0x65,0x1d,0x01,0x1c,0x12,0x0a,0x01,0x13,0x14,0x6e,0x2e,0x0b,0x1c,0x1d
240 ,0x2e,0x1d,0x13,0x0b,0x13,0x65,0x1d,0x1d,0x13,0x66,0x6f,0x6e,0x65,0x6f
241 ,0x77,0x7f,0x6f,0x6f,0x1d,0x14,0x13,0x6e,0x6e,0x66,0x6f,0x77,0x77,0x6f
242 ,0x66,0x66,0x13,0x25,0x0a,0x01,0x6e,0x66,0x01,0x12,0x02,0x01,0x1b,0x6e
243 ,0x77,0x77,0x77,0x77,0x77,0x6f,0x6f,0x6e,0x1c,0x1d,0x1c,0x77,0x67,0x6f
244 ,0x6f,0x77,0x67,0x77,0x77,0x66,0x13,0x0a,0x14,0x77,0x66,0x6f,0x77,0x66
245 ,0x1b,0x13,0x66,0x77,0x6f,0x77,0x6f,0x6f,0x6f,0x26,0x6e,0x1d,0x25,0x14
246 ,0x13,0x6e,0x6f,0x6f,0x77,0x6f,0x77,0x77,0x77,0x1d,0x1d,0x01,0x25,0x67
247 ,0x7f,0x6f,0x6f,0x66,0x66,0x14,0x66,0x6f,0x7f,0x6f,0x77,0x6f,0x1d,0x25
248 ,0x1d,0x66,0x1d,0x65,0x14,0x2e,0x26,0x77,0x6d,0x67,0x6f,0x25,0x6f,0x5e
249 ,0x5d,0x0b,0x5d,0x6f,0x6f,0x26,0x1d,0x77,0x66,0x1c,0x13,0x6f,0x6f,0x6f
250 ,0x66,0x67,0x66,0x65,0x6e,0x1c,0x1b,0x0a,0x01,0x1d,0x65,0x1e,0x6f,0x6e
251 ,0x67,0x66,0x66,0x65,0x14,0x1c,0x25,0x65,0x6e,0x66,0x66,0x6e,0x66,0x1c
252 ,0x02,0x1d,0x77,0x6e,0x77,0x66,0x25,0x13,0x5c,0x1d,0x0a,0x14,0x0b,0x14
253 ,0x6e,0x65,0x1d,0x66,0x1d,0x66,0x1d,0x66,0x14,0x25,0x14,0x6e,0x66,0x25
254 ,0x66,0x5d,0x66,0x25,0x0a,0x6e,0x6f,0x6f,0x6e,0x1d,0x13,0x65,0x5c,0x01
255 ,0x0a,0x15,0x1d,0x0a,0x01,0x5d,0x6e,0x5c,0x25,0x1d,0x1e,0x26,0x1d,0x1b
256 ,0x14,0x25,0x25,0x1d,0x14,0x1d,0x14,0x13,0x01,0x25,0x6e,0x25,0x25,0x25
257 ,0x1d,0x1c,0x01,0x0a,0x14,0x14,0x5d,0x14,0x14,0x0a,0x1d,0x5d,0x1c,0x6e
258 ,0x1d,0x65,0x5d,0x1d,0x0a,0x01,0x14,0x1c,0x25,0x0a,0x01,0x12,0x1c,0x0b
259 ,0x01,0x1c,0x14,0x25,0x0b,0x1b,0x25,0x14,0x25,0x02,0x1d,0x25,0x1d,0x09
260 ,0x13,0x1c,0x1d,0x66,0x1d,0x1c,0x0b,0x14,0x0b,0x65,0x2d,0x09,0x0a,0x09
261 ,0x14,0x66,0x6f,0x66,0x66,0x1c,0x0a,0x01,0x0b,0x14,0x66,0x1c,0x1d,0x1c
262 ,0x66,0x66,0x65,0x6e,0x1c,0x09,0x1c,0x1d,0x14,0x1c,0x0b,0x01,0x1d,0x6e
263 ,0x77,0x66,0x1c,0x1c,0x6e,0x6f,0x6f,0x77,0x7f,0x77,0x5e,0x6e,0x6f,0x67
264 ,0x6f,0x6f,0x0a,0x0a,0x66,0x67,0x66,0x25,0x13,0x1c,0x24,0x14,0x25,0x1c
265 ,0x0b,0x1d,0x6e,0x77,0x7f,0x77,0x5e,0x1c,0x65,0x6f,0x7f,0x6e,0x6f,0x77
266 ,0x6f,0x67,0x6f,0x6f,0x66,0x25,0x14,0x6f,0x6f,0x77,0x6f,0x67,0x6e,0x13
267 ,0x0a,0x09,0x13,0x12,0x1d,0x66,0x6f,0x66,0x5e,0x6e,0x66,0x25,0x14,0x25
268 ,0x26,0x25,0x6f,0x1d,0x77,0x6f,0x66,0x6e,0x66,0x1c,0x12,0x6f,0x6f,0x67
269 ,0x77,0x1d,0x77,0x13,0x66,0x77,0x6f,0x6f,0x6f,0x77,0x6f,0x66,0x77,0x77
270 ,0x6f,0x6e,0x13,0x25,0x26,0x25,0x66,0x65,0x66,0x66,0x6e,0x66,0x6e,0x14
271 ,0x09,0x66,0x6f,0x6e,0x2f,0x6e,0x26,0x1c,0x6f,0x66,0x6f,0x7f,0x6f,0x7f
272 ,0x6f,0x6f,0x6e,0x6e,0x66,0x6f,0x13,0x13,0x1d,0x66,0x1d,0x25,0x66,0x65
273 ,0x6e,0x1d,0x1d,0x0a,0x14,0x6f,0x77,0x77,0x2e,0x25,0x1c,0x0a,0x65,0x6f
274 ,0x6f,0x6f,0x7f,0x6f,0x77,0x77,0x66,0x6f,0x6e,0x6e,0x25,0x14,0x01,0x0a
275 ,0x09,0x0a,0x0b,0x14,0x1d,0x0a,0x14,0x13,0x66,0x6f,0x6f,0x25,0x1c,0x5d
276 ,0x65,0x01,0x66,0x1e,0x6f,0x6f,0x6f,0x77,0x6f,0x6f,0x6e,0x6f,0x66,0x1d
277 ,0x1d,0x0a,0x66,0x6f,0x66,0x2e,0x6e,0x6e,0x14,0x13,0x12,0x14,0x6f,0x6f
278 ,0x6e,0x6e,0x25,0x0a,0x13,0x12,0x6e,0x6f,0x66,0x6f,0x66,0x65,0x66,0x6f
279 ,0x66,0x25,0x66,0x25,0x0a,0x01,0x6e,0x77,0x77,0x6f,0x6f,0x6e,0x6e,0x14
280 ,0x1d,0x6e,0x1b,0x25,0x1d,0x1c,0x1d,0x14,0x01,0x25,0x25,0x66,0x6e,0x6f
281 ,0x1d,0x6f,0x66,0x1d,0x1d,0x1d,0x6e,0x1d,0x0b,0x6e,0x6f,0x77,0x7f,0x6f
282 ,0x77,0x77,0x66,0x66,0x13,0x5d,0x13,0x0a,0x01,0x1c,0x13,0x0a,0x6e,0x09
283 ,0x1d,0x65,0x25,0x66,0x66,0x6e,0x65,0x25,0x65,0x6e,0x1d,0x65,0x13,0x65
284 ,0x6f,0x77,0x67,0x7f,0x6f,0x77,0x6f,0x6e,0x14,0x1c,0x1c,0x6e,0x77,0x6e
285 ,0x77,0x6f,0x25,0x0a,0x1c,0x1d,0x1d,0x66,0x1d,0x6e,0x15,0x26,0x25,0x5e
286 ,0x25,0x13,0x1d,0x77,0x77,0x66,0x66,0x6e,0x6f,0x77,0x7f,0x6e,0x12,0x13
287 ,0x66,0x77,0x6f,0x77,0x6f,0x77,0x26,0x6f,0x0b,0x25,0x1c,0x25,0x25,0x25
288 ,0x66,0x1d,0x1b,0x25,0x0a,0x1d,0x6e,0x67,0x67,0x6f,0x66,0x1d,0x65,0x6e
289 ,0x67,0x6f,0x6e,0x13,0x77,0x7f,0x67,0x77,0x77,0x77,0x6f,0x6e,0x5d,0x13
290 ,0x14,0x1d,0x1c,0x1d,0x1d,0x14,0x1d,0x0a,0x09,0x1c,0x66,0x77,0x66,0x67
291 ,0x6e,0x1c,0x65,0x66,0x66,0x6d,0x1c,0x09,0x6e,0x67,0x6f,0x7f,0x6f,0x77
292 ,0x6f,0x6e,0x66,0x0a,0x01,0x13,0x1d,0x14,0x65,0x14,0x02,0x01,0x1d,0x1c
293 ,0x13,0x66,0x2e,0x66,0x77,0x6e,0x1e,0x25,0x25,0x6e,0x0a,0x13,0x6e,0x67
294 ,0x26,0x67,0x6f,0x77,0x67,0x6f,0x1d,0x6e,0x14,0x0a,0x01,0x13,0x01,0x25
295 ,0x66,0x77,0x66,0x65,0x1c,0x0b,0x66,0x25,0x66,0x66,0x25,0x6e,0x66,0x1d
296 ,0x14,0x0a,0x1d,0x66,0x66,0x66,0x6f,0x6e,0x6f,0x6f,0x5d,0x1d,0x0a,0x25
297 ,0x26,0x6f,0x6f,0x6f,0x7f,0x6f,0x6f,0x6f,0x77,0x0a,0x09,0x1d,0x6f,0x6e
298 ,0x15,0x25,0x1c,0x1d,0x1d,0x13,0x25,0x66,0x1c,0x6e,0x66,0x26,0x66,0x66
299 ,0x25,0x1c,0x0a,0x66,0x6f,0x7f,0x6f,0x6f,0x6f,0x66,0x6f,0x77,0x6e,0x66
300 ,0x0a,0x1b,0x26,0x1d,0x5e,0x1d,0x65,0x13,0x0a,0x1d,0x66,0x6e,0x25,0x6e
301 ,0x1d,0x1d,0x6e,0x25,0x13,0x1d,0x14,0x5e,0x77,0x27,0x7f,0x77,0x7f,0x67
302 ,0x66,0x67,0x1d,0x1d,0x13,0x09,0x76,0x66,0x24,0x1c,0x1b,0x13,0x13,0x1d
303 ,0x25,0x25,0x5e,0x1d,0x6e,0x25,0x1c,0x25,0x66,0x1d,0x09,0x1d,0x77,0x6f
304 ,0x66,0x6f,0x66,0x66,0x66,0x6e,0x65,0x66,0x65,0x1c,0x1d,0x1d,0x65,0x14
305 ,0x1c,0x25,0x0a,0x0a,0x0a,0x25,0x1d,0x66,0x14,0x25,0x66,0x6e,0x1d,0x25
306 ,0x09,0x1c,0x66,0x77,0x6f,0x66,0x7f,0x77,0x1d,0x6e,0x1c,0x1d,0x1d,0x0a
307 ,0x25,0x66,0x1d,0x25,0x13,0x0a,0x1d,0x14,0x1e,0x13,0x1d,0x14,0x65,0x66
308 ,0x66,0x25,0x1d,0x14,0x0a,0x14,0x15,0x65,0x7f,0x77,0x66,0x25,0x1d,0x1d
309 ,0x1d,0x6e,0x1c,0x14,0x13,0x65,0x1d,0x1c,0x0a,0x0a,0x65,0x1d,0x25,0x0a
310 ,0x1c,0x1d,0x1c,0x25,0x1d,0x1c,0x14,0x01,0x1b,0x0a,0x1d,0x65,0x6f,0x1d
311 ,0x66,0x65,0x6e,0x66,0x1d,0x14,0x0a,0x0a,0x1b,0x12,0x1c,0x0a,0x14,0x6e
315 const unsigned char texture3
[] =
316 { 32, 32 // width, height
317 ,0xb6,0x3d,0x33,0x33,0x3e,0x33,0x2a,0x29,0x2a,0x29,0x2a,0x20,0x29,0x29
318 ,0x2a,0x29,0x10,0x10,0x10,0x49,0x58,0x99,0x50,0x50,0x10,0x4b,0x54,0x54
319 ,0x55,0x55,0x4a,0x49,0x29,0x3d,0x3d,0x7c,0x3d,0x33,0x34,0x3d,0x33,0x33
320 ,0x33,0x20,0x20,0x29,0x10,0x20,0x10,0x50,0x10,0x49,0x10,0x99,0x51,0x51
321 ,0x33,0x10,0x53,0x66,0x67,0x15,0x54,0x4b,0x7f,0x33,0x7f,0x3d,0x3e,0x3d
322 ,0x33,0x3d,0x29,0x29,0x2a,0x20,0x20,0x2a,0x10,0x20,0x10,0x51,0x50,0x50
323 ,0x58,0x51,0x51,0x51,0x33,0x33,0x10,0x55,0x5e,0x67,0x26,0x66,0x29,0x7f
324 ,0x3e,0x3d,0x3d,0x33,0x3d,0x33,0x29,0x10,0x10,0x20,0x33,0x10,0x10,0x2a
325 ,0x58,0x59,0x50,0x10,0x51,0x51,0x10,0x51,0x52,0x37,0x37,0x10,0x10,0x5d
326 ,0x53,0x55,0x6c,0x3e,0x3d,0x33,0x33,0x3d,0x33,0x29,0x10,0x2a,0x20,0x20
327 ,0x29,0x20,0x10,0x10,0x58,0x10,0x10,0x10,0x58,0x49,0x51,0x99,0x49,0x37
328 ,0x37,0x33,0x33,0x10,0x10,0x49,0x7f,0x7f,0x33,0x3d,0x3d,0x7f,0x33,0x3e
329 ,0x29,0x2a,0x29,0x2a,0x29,0x2a,0x20,0x20,0x20,0x50,0x51,0x10,0x58,0x51
330 ,0x51,0x99,0x49,0x00,0x33,0x10,0x10,0x10,0x10,0x10,0x3d,0x7f,0x3d,0x33
331 ,0x3d,0x3d,0x33,0x2a,0x2a,0x20,0x29,0x29,0x29,0x10,0x20,0x19,0x10,0x19
332 ,0x51,0x50,0x58,0x51,0x49,0x99,0x00,0x00,0x10,0x10,0x33,0x33,0x33,0x10
333 ,0x3d,0x7f,0x7f,0x33,0x3e,0x33,0x33,0x33,0x29,0x20,0x33,0x2a,0x20,0x58
334 ,0x58,0x19,0x19,0x51,0x10,0x51,0x59,0x51,0x51,0x51,0x00,0x10,0x10,0x00
335 ,0x00,0x10,0x10,0x10,0x3d,0xb6,0x2a,0x3e,0x33,0x3d,0x33,0x3d,0x2a,0x10
336 ,0x20,0x2a,0x10,0x58,0x58,0x19,0x50,0x19,0x58,0x10,0x58,0x99,0x51,0x49
337 ,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x3d,0x2a,0x6c,0x3d,0x3e,0x33
338 ,0x33,0x29,0x33,0x29,0x10,0x29,0x20,0x69,0x58,0x10,0x19,0x10,0x99,0x10
339 ,0x58,0x99,0x49,0x99,0x51,0x00,0x00,0x00,0x10,0x10,0x10,0x53,0xb6,0x3d
340 ,0x6c,0x33,0x33,0x33,0x3d,0x29,0x20,0x33,0x20,0x20,0x29,0x20,0x51,0x51
341 ,0x51,0x50,0x99,0x58,0x99,0x49,0x99,0x49,0x00,0x00,0x00,0x10,0x10,0x00
342 ,0x00,0x53,0x29,0x3e,0x7f,0x29,0x33,0x2a,0x33,0x29,0x29,0x33,0x20,0x29
343 ,0x10,0x58,0x10,0x49,0x51,0x58,0x99,0x49,0x49,0x51,0x51,0x00,0x00,0x00
344 ,0x00,0x00,0x00,0x00,0x53,0x33,0x29,0x33,0x7e,0x33,0xb6,0x2a,0x33,0x29
345 ,0x20,0x10,0x29,0x20,0x10,0x58,0x59,0x10,0x50,0x99,0x49,0x49,0x49,0x49
346 ,0x51,0x9a,0x4b,0x53,0x53,0x4a,0x4a,0x15,0x37,0x37,0x2d,0x7c,0x3e,0x3d
347 ,0x7f,0x29,0x2a,0x10,0x29,0x10,0x10,0x20,0x29,0x58,0x51,0x51,0x99,0x51
348 ,0x49,0x49,0x99,0x10,0x49,0x49,0x4a,0x4b,0x53,0x56,0x56,0x33,0x37,0x37
349 ,0x6c,0x33,0x3d,0x3d,0x3d,0x7f,0x20,0x10,0x29,0x10,0x10,0x99,0x10,0x58
350 ,0x51,0x49,0x49,0x49,0x49,0x58,0x49,0x51,0x4a,0x4b,0x4b,0x54,0x66,0x67
351 ,0x67,0x33,0x10,0x10,0xb6,0x3d,0x33,0x7f,0x29,0x3d,0x33,0x33,0x29,0x29
352 ,0xac,0x58,0x10,0x49,0x49,0x49,0x49,0x49,0x49,0x50,0x59,0x51,0x51,0x51
353 ,0x54,0x15,0x66,0x5e,0x33,0x10,0x56,0x54,0xb6,0x3d,0x33,0x33,0x3e,0x33
354 ,0x29,0x33,0x33,0x33,0x10,0x10,0x10,0x51,0x49,0x49,0x49,0x49,0x49,0x49
355 ,0x58,0x50,0x50,0x49,0x4b,0x54,0x54,0x55,0x55,0x55,0x4a,0x49,0x29,0x3d
356 ,0x3d,0x7c,0x7f,0x6c,0x2a,0x29,0x10,0x10,0x10,0x19,0x20,0x10,0x99,0x51
357 ,0x51,0x49,0x49,0x49,0x10,0x51,0x51,0x51,0x52,0x53,0x66,0x67,0x67,0x15
358 ,0x54,0x4b,0x29,0x33,0x7f,0x3d,0x6c,0x29,0x33,0x20,0x29,0x10,0x20,0x20
359 ,0x99,0x10,0x99,0x51,0x58,0x99,0x49,0x49,0x49,0x51,0x51,0x4b,0x4b,0x53
360 ,0x55,0x5e,0x5e,0x67,0x26,0x66,0x29,0x7f,0x3e,0x3d,0x29,0x29,0x33,0x2a
361 ,0x2a,0x20,0x33,0x20,0x61,0x20,0x58,0x10,0x10,0x99,0x99,0x49,0x49,0x10
362 ,0x51,0x52,0x4a,0x4b,0x53,0x54,0x54,0x5d,0x53,0x55,0x6c,0x7f,0x6c,0x29
363 ,0x33,0x3d,0x2a,0x20,0x29,0x2a,0x10,0x2a,0x20,0x20,0x58,0x10,0x10,0x58
364 ,0x99,0x51,0x51,0x49,0x99,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x54,0x54
365 ,0xb6,0xb6,0x33,0x3d,0x3e,0x3e,0x2a,0x33,0x20,0x2a,0x20,0x33,0x2a,0x58
366 ,0x58,0x50,0x10,0x58,0x10,0x10,0x58,0x99,0x00,0x99,0x00,0x00,0x00,0x00
367 ,0x33,0x10,0x00,0x49,0xb6,0x29,0x3f,0x33,0x33,0x33,0x3d,0x33,0x20,0x2a
368 ,0x33,0x2a,0x29,0x58,0x99,0x10,0x50,0x10,0x10,0x10,0x10,0x99,0x51,0x00
369 ,0x51,0x00,0x10,0x10,0x33,0x33,0x10,0x00,0x3d,0x6c,0x3d,0x33,0x3e,0x33
370 ,0x33,0x2a,0x2a,0x2a,0x33,0x29,0x10,0x58,0x58,0x10,0x10,0x10,0x51,0x10
371 ,0x50,0x99,0x51,0x51,0x00,0x00,0x00,0x10,0x10,0x37,0x37,0x10,0x7f,0xb6
372 ,0x33,0x3d,0x33,0x3f,0x2a,0x33,0x2a,0x33,0x29,0x10,0x10,0x29,0x10,0x33
373 ,0x10,0x50,0x49,0x10,0x51,0x51,0x51,0x51,0x51,0x00,0x00,0x00,0x00,0x33
374 ,0x37,0x33,0x3d,0x2a,0x3d,0x3d,0x3e,0x33,0x33,0x2a,0x2a,0x33,0x33,0x10
375 ,0x2a,0x20,0x10,0x10,0x10,0x50,0x49,0x58,0x51,0x51,0x58,0x99,0x00,0x00
376 ,0x00,0x00,0x00,0x10,0x33,0x33,0x7f,0x3d,0x33,0x7f,0x3d,0x3d,0x33,0x3d
377 ,0x20,0x29,0x20,0x33,0x2a,0x10,0x10,0x2a,0x10,0x10,0x10,0x58,0x99,0x51
378 ,0x59,0x99,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x33,0x29,0x3e,0x3d,0x3d
379 ,0x7c,0x3e,0x2a,0x3d,0x2c,0x2a,0x20,0x33,0x29,0x20,0x10,0x2a,0x10,0x10
380 ,0x49,0x10,0x99,0x49,0x51,0x51,0x49,0x00,0x10,0x10,0x10,0x10,0x53,0x14
381 ,0x29,0x33,0x7e,0x33,0x3d,0x3d,0x33,0x33,0x29,0x20,0x20,0x33,0x20,0x20
382 ,0x20,0x20,0x10,0x51,0x50,0x10,0x99,0x49,0x49,0x51,0x9a,0x4b,0x53,0x53
383 ,0x4a,0x15,0x56,0x54,0x2d,0x7c,0x3e,0x3d,0x3d,0x7e,0x3d,0x3d,0x2a,0x33
384 ,0x10,0x29,0x2a,0x29,0x10,0x20,0x10,0x58,0x58,0x58,0x99,0x51,0x10,0x49
385 ,0x49,0x4a,0x4b,0x53,0x56,0x54,0x4b,0x54,0x6c,0x33,0x3d,0x3d,0x3d,0x33
386 ,0x3d,0x33,0x29,0x33,0x20,0x20,0x20,0x10,0x2a,0x10,0x50,0x99,0x58,0x58
387 ,0x51,0x51,0x51,0x4a,0x4b,0x4b,0x54,0x66,0x67,0x56,0x2e,0x5e,0xb6,0x3d
388 ,0x33,0x7f,0x29,0x3d,0x2a,0x29,0x33,0x29,0x20,0x2a,0x10,0x10,0x2a,0x10
389 ,0x10,0x50,0x10,0x50,0x59,0x51,0x51,0x51,0x51,0x54,0x15,0x66,0x5e,0x15
393 const unsigned char texture4
[] =
394 { 32, 32 // width, height
395 ,0x12,0x1c,0x65,0x65,0x65,0x65,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b
396 ,0x13,0x00,0x5b,0x5b,0xad,0xad,0xad,0xad,0x5b,0x00,0x64,0xad,0xad,0x64
397 ,0x64,0x64,0x5b,0x00,0x1c,0x1b,0x1b,0x1b,0x13,0x13,0x12,0x13,0x12,0x12
398 ,0x12,0x12,0x0a,0x0a,0x09,0x00,0x5b,0x5b,0xad,0xad,0xad,0x64,0x5b,0x00
399 ,0xad,0x64,0x64,0x64,0x64,0x64,0x5b,0x00,0x65,0x1b,0x1b,0x13,0x13,0x12
400 ,0x0a,0x0a,0x12,0x0a,0x0a,0x0a,0x0a,0x09,0x09,0x00,0x5b,0x5b,0xad,0xad
401 ,0xad,0x64,0x5b,0x00,0xad,0x64,0x64,0x64,0x64,0x64,0x5b,0x00,0x65,0x1b
402 ,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x0a,0x09,0x00
403 ,0x5b,0x5b,0xad,0xad,0x64,0x64,0x5b,0x00,0x64,0x64,0x64,0x64,0x64,0x64
404 ,0x12,0x00,0x65,0x13,0x12,0x00,0x09,0x09,0x0a,0x09,0x09,0x09,0x09,0x09
405 ,0x13,0x0a,0x09,0x00,0x5b,0x5b,0xad,0x64,0x64,0x5b,0x5b,0x00,0x64,0x64
406 ,0x64,0x64,0x64,0x64,0x5b,0x00,0x65,0x13,0x12,0x00,0x09,0x0a,0x12,0x12
407 ,0x0a,0x12,0x12,0x0a,0x1b,0x0a,0x09,0x00,0x5b,0x5b,0x64,0x64,0x5b,0x64
408 ,0x5b,0x00,0x64,0x64,0x64,0x64,0x64,0x64,0x5b,0x00,0x65,0x12,0x13,0x00
409 ,0x09,0x12,0x0a,0x0a,0x12,0x0a,0x0a,0x0a,0x1c,0x09,0x0a,0x00,0x5b,0x5b
410 ,0x64,0x64,0x64,0x64,0x5b,0x00,0x5b,0x5b,0x5b,0x12,0x5b,0x12,0x5b,0x00
411 ,0x65,0x13,0x12,0x00,0x09,0x12,0x0a,0x0a,0x0a,0x09,0x0a,0x09,0x1c,0x0a
412 ,0x0a,0x00,0x5b,0x5b,0xad,0x64,0x5b,0x64,0x5b,0x00,0x00,0x00,0x00,0x00
413 ,0x00,0x00,0x00,0x00,0x1c,0x12,0x0a,0x00,0x09,0x12,0x0a,0x0a,0x09,0x0a
414 ,0x09,0x09,0x1c,0x0a,0x0a,0x00,0x52,0x52,0x64,0x64,0x64,0x5b,0x5b,0x00
415 ,0xad,0xad,0xad,0xad,0xad,0xad,0x5b,0x00,0x1c,0x12,0x0a,0x00,0x09,0x0a
416 ,0x0a,0x0a,0x09,0x09,0x09,0x09,0x65,0x0a,0x09,0x00,0x5b,0x52,0x64,0x64
417 ,0x5b,0x64,0x5b,0x00,0xad,0xad,0xad,0xad,0xad,0x64,0x5b,0x00,0x1b,0x0a
418 ,0x12,0x00,0x09,0x0a,0x09,0x09,0x0a,0x0a,0x09,0x09,0x65,0x09,0x09,0x00
419 ,0x5b,0x5b,0x5b,0x64,0x5b,0x5b,0x5b,0x00,0xad,0xad,0xad,0xad,0xad,0x64
420 ,0x5b,0x00,0x1b,0x12,0x0a,0x00,0x09,0x0a,0x0a,0x09,0x0a,0x09,0x09,0x0a
421 ,0x1c,0x09,0x09,0x00,0x52,0x12,0x64,0x64,0x64,0x5b,0x5b,0x00,0xad,0xad
422 ,0xad,0xad,0x64,0x64,0x5b,0x00,0x1b,0x0a,0x09,0x09,0x13,0x1b,0x1c,0x1c
423 ,0x65,0x65,0x1c,0x1c,0x1b,0x09,0x09,0x00,0x5b,0x52,0x64,0x64,0x64,0x5b
424 ,0x12,0x00,0xad,0xad,0xad,0x64,0x64,0x5b,0x5b,0x00,0x1b,0x0a,0x09,0x0a
425 ,0x09,0x09,0x09,0x0a,0x09,0x0a,0x09,0x09,0x09,0x09,0x09,0x00,0x12,0x12
426 ,0x5b,0x5b,0x5b,0x5b,0x5b,0x00,0xad,0xad,0x64,0x64,0x5b,0x5b,0x12,0x00
427 ,0x13,0x09,0x09,0x09,0x09,0x09,0x0a,0x0a,0x09,0x09,0x09,0x09,0x09,0x09
428 ,0x09,0x00,0x09,0x09,0x5b,0x12,0x12,0x12,0x12,0x00,0xad,0xad,0x64,0x64
429 ,0x64,0x64,0x5b,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
430 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
431 ,0xad,0x64,0x64,0x5b,0x5b,0x5b,0x12,0x00,0x12,0x1c,0x65,0x65,0x65,0x65
432 ,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x13,0x00,0x5b,0x5b,0xad,0x64
433 ,0xad,0xad,0x5b,0x00,0x64,0x64,0x64,0x5b,0x5b,0x64,0x5b,0x00,0x1c,0x1b
434 ,0x1b,0x1b,0x1b,0x13,0x12,0x13,0x12,0x12,0x12,0x12,0x0a,0x0a,0x09,0x00
435 ,0x5b,0x5b,0xad,0xad,0xad,0x64,0x5b,0x00,0xad,0x64,0x5b,0x5b,0x5b,0x5b
436 ,0x5b,0x00,0x65,0x1b,0x1b,0x13,0x13,0x12,0x0a,0x0a,0x12,0x0a,0x0a,0x0a
437 ,0x0a,0x09,0x09,0x00,0x5b,0x5b,0xad,0x64,0x64,0x64,0x5b,0x00,0x64,0x64
438 ,0x64,0x64,0x5b,0x5b,0x5b,0x00,0x65,0x13,0x1b,0x00,0x00,0x00,0x00,0x00
439 ,0x00,0x00,0x00,0x00,0x09,0x0a,0x09,0x00,0x5b,0x5b,0x64,0x64,0x64,0x64
440 ,0x5b,0x00,0x64,0x64,0x64,0x64,0x5b,0x64,0x5b,0x00,0x65,0x1b,0x13,0x00
441 ,0x09,0x09,0x0a,0x09,0x09,0x09,0x09,0x09,0x1b,0x0a,0x09,0x00,0x5b,0x5b
442 ,0xad,0x64,0x5b,0x64,0x5b,0x00,0x64,0x64,0x64,0x64,0x5b,0x5b,0x5b,0x00
443 ,0x65,0x13,0x12,0x00,0x09,0x0a,0x12,0x12,0x0a,0x12,0x12,0x12,0x1b,0x0a
444 ,0x09,0x00,0x5b,0x52,0x64,0x64,0x5b,0x5b,0x5b,0x00,0x64,0x64,0x64,0x64
445 ,0x5b,0x5b,0x12,0x00,0x65,0x12,0x13,0x00,0x09,0x12,0x0a,0x0a,0x0a,0x0a
446 ,0x0a,0x0a,0x1c,0x09,0x0a,0x00,0x5b,0x5b,0x64,0x64,0x5b,0x64,0x5b,0x00
447 ,0x5b,0x5b,0x5b,0x5b,0x5b,0x12,0x5b,0x00,0x65,0x13,0x12,0x00,0x09,0x12
448 ,0x0a,0x0a,0x0a,0x09,0x0a,0x09,0x1c,0x0a,0x0a,0x00,0x5b,0x52,0x64,0x5b
449 ,0x64,0x5b,0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x12
450 ,0x0a,0x00,0x09,0x12,0x0a,0x0a,0x09,0x0a,0x09,0x09,0x1c,0x0a,0x0a,0x00
451 ,0x52,0x5b,0x64,0x64,0x5b,0x5b,0x5b,0x00,0xad,0xad,0xad,0xad,0xad,0xad
452 ,0x5b,0x00,0x1c,0x12,0x0a,0x00,0x09,0x0a,0x0a,0x0a,0x09,0x09,0x09,0x09
453 ,0x65,0x0a,0x09,0x00,0x5b,0x52,0x64,0x64,0x5b,0x5b,0x5b,0x00,0xad,0xad
454 ,0xad,0xad,0xad,0x64,0x5b,0x00,0x1b,0x0a,0x12,0x00,0x09,0x0a,0x09,0x09
455 ,0x0a,0x0a,0x09,0x09,0x65,0x09,0x09,0x00,0x52,0x12,0x64,0x5b,0x5b,0x5b
456 ,0x5b,0x00,0xad,0xad,0xad,0xad,0xad,0x64,0x5b,0x00,0x1b,0x12,0x0a,0x00
457 ,0x09,0x0a,0x0a,0x09,0x0a,0x09,0x09,0x0a,0x1c,0x09,0x09,0x00,0x52,0x52
458 ,0x5b,0x5b,0x5b,0x64,0x5b,0x00,0xad,0xad,0xad,0xad,0x64,0x64,0x5b,0x00
459 ,0x1b,0x0a,0x09,0x09,0x13,0x1b,0x1c,0x1c,0x65,0x65,0x1c,0x1c,0x1b,0x09
460 ,0x09,0x00,0x12,0x12,0x5b,0x5b,0x5b,0x5b,0x5b,0x00,0xad,0xad,0xad,0xad
461 ,0xad,0x64,0x5b,0x00,0x1b,0x0a,0x09,0x0a,0x0a,0x09,0x09,0x09,0x09,0x09
462 ,0x09,0x09,0x09,0x09,0x09,0x00,0x12,0x12,0x5b,0x5b,0x5b,0x5b,0x12,0x00
463 ,0xad,0xad,0xad,0x64,0xad,0x64,0x5b,0x00,0x13,0x09,0x0a,0x09,0x09,0x09
464 ,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x00,0x09,0x12,0x5b,0x5b
465 ,0x5b,0x12,0x5b,0x00,0xad,0xad,0x64,0x64,0xad,0x64,0x5b,0x00,0x0a,0x00
466 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
467 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x64,0xad,0x64,0xad,0x64
471 const unsigned char sprite1
[] =
472 { 32, 32 // width, height
473 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00
474 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07
475 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
476 ,0x00,0x00,0x00,0x64,0x64,0x64,0x76,0x64,0x64,0x64,0x64,0x64,0x00,0x07
477 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
478 ,0x07,0x07,0x00,0x00,0x64,0x76,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00
479 ,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07
480 ,0x07,0x07,0x07,0x07,0x00,0x00,0x76,0x64,0x00,0x00,0x00,0x09,0x09,0x09
481 ,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x52,0x76,0x76,0x64
482 ,0x52,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x76,0x64,0x00,0x09,0x09,0x09
483 ,0x09,0x09,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x52
484 ,0x09,0x76,0x52,0x64,0x52,0x00,0x07,0x07,0x07,0x00,0xff,0x76,0x09,0x09
485 ,0x52,0x09,0x52,0x09,0x09,0x52,0x09,0x00,0x07,0x07,0x07,0x07,0x07,0x07
486 ,0x00,0x76,0x76,0x64,0x52,0x64,0x09,0x64,0x52,0x00,0x07,0x07,0x00,0xff
487 ,0x09,0x09,0x09,0x52,0x09,0x52,0x09,0x52,0x52,0x52,0x52,0x00,0x00,0x07
488 ,0x07,0x07,0x07,0x00,0x52,0x76,0x52,0x64,0x09,0x76,0x52,0x64,0x52,0x00
489 ,0x07,0x00,0x76,0x52,0x52,0x64,0x64,0x52,0x52,0x52,0x52,0x64,0x52,0x64
490 ,0x64,0x64,0x64,0x00,0x07,0x07,0x00,0x52,0x09,0x76,0x09,0x64,0x52,0x76
491 ,0x09,0x64,0x52,0x00,0x00,0x76,0x64,0x00,0x00,0x00,0x00,0x00,0x64,0x52
492 ,0x52,0x52,0x52,0x52,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x52,0x09,0x64
493 ,0x52,0x64,0x52,0x76,0x52,0x64,0x52,0x00,0x00,0xff,0x00,0x07,0x07,0x07
494 ,0x07,0x07,0x00,0x64,0x52,0x52,0x52,0x00,0x00,0x00,0x07,0x07,0x07,0x07
495 ,0x00,0x00,0x09,0x76,0x09,0x64,0x09,0x64,0x52,0x52,0x52,0x00,0x07,0x00
496 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x64,0x52,0x00,0x00,0x76,0x76
497 ,0x00,0x07,0x07,0x07,0x00,0x64,0x09,0x76,0x52,0x64,0x09,0x76,0x09,0x52
498 ,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x07,0x00,0x64,0x09
499 ,0x00,0x76,0x64,0x00,0x00,0x07,0x07,0x07,0x00,0x52,0x00,0x76,0x09,0x52
500 ,0x09,0x64,0x52,0x64,0x52,0x00,0x07,0x00,0x07,0x07,0x00,0x64,0x76,0x64
501 ,0x00,0x07,0x00,0x09,0x76,0x64,0x76,0x00,0x76,0x00,0x07,0x00,0x64,0x64
502 ,0x09,0x64,0x52,0x64,0x09,0x76,0x52,0x64,0x52,0x00,0x00,0xff,0x00,0x00
503 ,0x76,0x00,0x00,0x64,0x64,0x00,0x52,0x52,0x64,0x00,0x00,0x76,0x64,0x64
504 ,0x00,0x64,0x00,0x00,0x09,0x76,0x09,0x64,0x09,0x76,0x52,0x52,0x52,0x00
505 ,0x07,0x00,0x76,0x76,0x00,0x07,0x07,0x00,0x64,0x00,0x09,0x64,0x52,0x64
506 ,0x64,0x64,0x00,0x00,0x64,0x00,0x00,0x52,0x09,0x64,0x09,0x52,0x00,0x76
507 ,0x09,0x64,0x52,0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x07,0x00,0x64,0x52
508 ,0x64,0x52,0x52,0x64,0x64,0x00,0x07,0x07,0x00,0x07,0x00,0x52,0x09,0x64
509 ,0x52,0x52,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x07,0x00,0x00,0x07,0x07
510 ,0x07,0x00,0x64,0x52,0x64,0x52,0x52,0x52,0x64,0x00,0x07,0x07,0x00,0x07
511 ,0x00,0x52,0x00,0x64,0x09,0x64,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x00
512 ,0x64,0x64,0x00,0x07,0x07,0x00,0x52,0x00,0x09,0x64,0x52,0x52,0x52,0x64
513 ,0x00,0x00,0x64,0x00,0x00,0x09,0x00,0x76,0x09,0x52,0x00,0x76,0x09,0x52
514 ,0x52,0x00,0x00,0x64,0x00,0x00,0x64,0x00,0x00,0x52,0x64,0x00,0x52,0x52
515 ,0x64,0x00,0x00,0x64,0x64,0x64,0x00,0x64,0x00,0x00,0x00,0x64,0x09,0x52
516 ,0x00,0x64,0x52,0x52,0x52,0x00,0x07,0x00,0x07,0x07,0x00,0x52,0x64,0x52
517 ,0x00,0x07,0x00,0x09,0x64,0x64,0x64,0x00,0x64,0x00,0x07,0x00,0x64,0x64
518 ,0x00,0x64,0x09,0x52,0x00,0x64,0x09,0x64,0x52,0x00,0x07,0x07,0x07,0x07
519 ,0x07,0x00,0x00,0x00,0x07,0x00,0x64,0x00,0x00,0x64,0x52,0x00,0x00,0x07
520 ,0x07,0x07,0x00,0x52,0x09,0x64,0x52,0x52,0x00,0x64,0x52,0x52,0x52,0x00
521 ,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x64,0x00,0x00,0x00
522 ,0x64,0x64,0x00,0x07,0x07,0x07,0x00,0x64,0x00,0x64,0x09,0x52,0x00,0x52
523 ,0x09,0x52,0x52,0x00,0x00,0x64,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x64
524 ,0x00,0x00,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x52
525 ,0x52,0x52,0x00,0x64,0x09,0x52,0x52,0x00,0x00,0x64,0x64,0x00,0x00,0x00
526 ,0x00,0x00,0x64,0x00,0x00,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x07,0x07
527 ,0x00,0x00,0x00,0x64,0x09,0x52,0x00,0x52,0x09,0x52,0x52,0x00,0x07,0x00
528 ,0x64,0x00,0x09,0x52,0x52,0x52,0x09,0x09,0x52,0x09,0x52,0x52,0x52,0x52
529 ,0x52,0x00,0x00,0x07,0x00,0x09,0x00,0x52,0x09,0x52,0x00,0x52,0x52,0x52
530 ,0x52,0x00,0x07,0x07,0x00,0x64,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09
531 ,0x09,0x09,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x09,0x64,0x52,0x52
532 ,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x07,0x07,0x00,0x64,0x64,0x00,0x09
533 ,0x09,0x52,0x09,0x09,0x09,0x09,0x52,0x00,0x00,0x07,0x07,0x07,0x07,0x07
534 ,0x00,0x52,0x52,0x52,0x00,0x52,0x09,0x52,0x52,0x00,0x07,0x07,0x07,0x07
535 ,0x00,0x00,0x64,0x64,0x09,0x09,0x09,0x52,0x09,0x52,0x09,0x00,0x00,0x00
536 ,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x64,0x52,0x52,0x52,0x00
537 ,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x64,0x64,0x09,0x09,0x52,0x09
538 ,0x52,0x09,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x09,0x52
539 ,0x52,0x52,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00
540 ,0x64,0x64,0x64,0x09,0x09,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x07,0x07
541 ,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07
542 ,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x64,0x64,0x64,0x64,0x64,0x64,0x64
543 ,0x64,0x64,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
544 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00
545 ,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
549 const unsigned char sprite2
[] =
550 { 32, 32 // width, height
551 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
552 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
553 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
554 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
555 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
556 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
557 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
558 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
559 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
560 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
561 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
562 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
563 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x07,0x07,0x07
564 ,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07
565 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0xbf,0xbf
566 ,0xbf,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x27,0x00,0x07,0x07
567 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
568 ,0x07,0x00,0xbf,0x5b,0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0x27,0x27
569 ,0x0c,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
570 ,0x07,0x07,0x07,0x07,0x00,0x52,0x6d,0x5b,0x09,0x0c,0x0c,0x0c,0x27,0x27
571 ,0x27,0x0c,0x0a,0x0a,0x0a,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
572 ,0x07,0x07,0x07,0x07,0x07,0x00,0x07,0x00,0x5b,0x09,0x09,0x09,0x0a,0x0a
573 ,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0b,0x0b,0x0a,0x00,0x07,0x07,0x00,0x00
574 ,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x3f,0x00,0x5b,0x09,0x5b
575 ,0x09,0x00,0x02,0x01,0x01,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x00
576 ,0x00,0x07,0x00,0x3e,0xb6,0x00,0x07,0x00,0x07,0x07,0x07,0x00,0x15,0x15
577 ,0x3d,0x09,0x09,0x09,0x00,0x01,0x01,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x01
578 ,0x01,0x01,0x01,0x52,0x52,0x00,0x07,0x00,0x3e,0x6d,0x00,0xb6,0x00,0x07
579 ,0x00,0x0c,0x0c,0x15,0x15,0x3d,0x00,0x00,0x0a,0x0a,0x00,0x00,0x00,0x01
580 ,0x01,0x01,0x01,0x01,0x01,0x01,0x52,0x6d,0x52,0x00,0x07,0x07,0x00,0x3d
581 ,0x5b,0x6d,0x00,0x00,0x27,0x27,0x0c,0x0c,0x15,0x3f,0x00,0x01,0x00,0x00
582 ,0x09,0x00,0x52,0x00,0x09,0x00,0x00,0x00,0x01,0x01,0x09,0xb6,0x09,0x00
583 ,0x07,0x07,0x07,0x00,0x3d,0x09,0x00,0x0a,0x0c,0x15,0x27,0x09,0x09,0x09
584 ,0x09,0x00,0x3f,0x00,0x52,0x09,0x64,0x00,0x3d,0x3d,0x3f,0x64,0x64,0x09
585 ,0xb6,0x6d,0x09,0x00,0x07,0x07,0x00,0xbf,0x6d,0x00,0x5b,0x52,0x0a,0x09
586 ,0x09,0x09,0x5b,0x6d,0x09,0x5b,0x3d,0x00,0x64,0x00,0x64,0x09,0x00,0x1d
587 ,0x3f,0x5b,0x52,0x52,0x09,0x52,0x00,0x00,0x07,0x00,0xb6,0xff,0x3e,0x00
588 ,0x3e,0x3e,0x3d,0x09,0x5b,0x6d,0xbf,0xb6,0x52,0x3e,0x1d,0x3d,0x00,0x64
589 ,0x00,0x52,0x00,0x00,0x09,0x52,0x52,0x12,0x09,0x00,0x00,0x00,0x00,0x3d
590 ,0x3d,0x3d,0x00,0x00,0x00,0x00,0x09,0x09,0x09,0x6d,0x6d,0x52,0x52,0x3e
591 ,0x1d,0x3d,0x00,0x64,0x00,0x52,0x00,0x02,0x00,0x00,0x09,0x00,0x00,0x01
592 ,0x00,0x00,0x07,0x00,0x52,0x5b,0x3d,0x00,0x3d,0x3f,0x3f,0x09,0x5b,0x52
593 ,0x5b,0x6d,0x52,0x3d,0x1d,0x3f,0x00,0x64,0x00,0x52,0x00,0x01,0x01,0x01
594 ,0x01,0x0a,0x0a,0x0a,0x00,0x00,0x07,0x07,0x00,0x52,0x5b,0x00,0x52,0x52
595 ,0x0a,0x27,0x09,0x09,0x09,0x09,0x52,0x5b,0x3f,0x00,0x00,0x64,0x00,0x52
596 ,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x07,0x07,0x07,0x07,0x00
597 ,0x3f,0x09,0x00,0x0a,0x0c,0x27,0x0c,0x15,0x3f,0x09,0x09,0x09,0x3f,0x00
598 ,0x64,0x00,0x52,0x09,0x00,0x3d,0x3f,0x5b,0x00,0x00,0x01,0x01,0x00,0x07
599 ,0x07,0x07,0x00,0x1d,0x52,0x5b,0x00,0x0c,0x27,0x0c,0x0c,0x15,0x0c,0x3d
600 ,0x00,0x00,0x00,0x00,0x52,0x09,0x00,0x00,0x3f,0x3e,0x3d,0x52,0x52,0x64
601 ,0x09,0x52,0x00,0x00,0x07,0x00,0x1d,0x5b,0x00,0x5b,0x00,0x27,0x0c,0x0c
602 ,0x15,0x15,0x15,0x3d,0x52,0x52,0x0a,0x52,0xbf,0x6d,0x00,0x00,0x00,0x3f
603 ,0x52,0x12,0x12,0x09,0x64,0xb6,0x52,0x00,0x00,0x3f,0x5b,0x00,0x07,0x00
604 ,0x07,0x00,0x00,0x0c,0x27,0x15,0x15,0x3e,0x00,0x09,0x52,0xbf,0x6d,0x5b
605 ,0x0a,0x0a,0x0a,0x01,0x00,0x00,0x00,0x00,0x00,0x64,0x09,0x00,0x00,0x00
606 ,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x27,0x3e,0x27,0x27,0x15
607 ,0x09,0x00,0x00,0x0a,0x0a,0x0a,0x0a,0x0a,0x01,0x01,0x01,0x00,0x00,0x09
608 ,0x09,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00
609 ,0x3d,0x0c,0x0c,0x27,0x27,0x27,0x27,0x15,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a
610 ,0x01,0x01,0x01,0x0a,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
611 ,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x27,0x27,0x27
612 ,0x27,0x15,0x15,0x0a,0x0a,0x0a,0x0a,0x0a,0x00,0x07,0x07,0x07,0x07,0x07
613 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
614 ,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,0x15,0x15,0x00,0x07
615 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
616 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00
617 ,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
618 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
619 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
620 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
621 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
622 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
623 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
627 const unsigned char sprite3
[] =
628 { 32, 32 // width, height
629 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x7b,0x7b,0x58,0x07,0x07
630 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
631 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x7b,0x7b
632 ,0x7b,0x58,0x07,0x61,0x28,0x28,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x07
633 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
634 ,0x07,0x08,0x7b,0x7b,0x58,0x58,0x08,0x7b,0x28,0x28,0x08,0x08,0x07,0x08
635 ,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
636 ,0x07,0x7b,0x7b,0x28,0x58,0x08,0x7b,0x7b,0x58,0x58,0x7b,0x7b,0x28,0x28
637 ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07
638 ,0x07,0x07,0x07,0x07,0x07,0x7b,0x7b,0x7b,0x58,0x08,0x7b,0x7b,0x28,0x7b
639 ,0x7b,0x7b,0x08,0x08,0x08,0x58,0x58,0x08,0x58,0x58,0x58,0x07,0x07,0x07
640 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x7b,0x28,0x7b,0x08,0x58
641 ,0x28,0x7b,0x58,0x58,0x58,0x7b,0x58,0x08,0x08,0x58,0x58,0x58,0x58,0x58
642 ,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x13,0x07,0x07,0x28,0x7b
643 ,0x28,0x28,0x58,0x58,0x7b,0x7b,0x7b,0x28,0x7b,0x7b,0x58,0x08,0x08,0x08
644 ,0x58,0x08,0x08,0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x13,0x09
645 ,0x07,0x07,0x28,0x7b,0x7b,0x28,0x28,0x7b,0x7b,0x7b,0x7b,0x28,0x7b,0x7b
646 ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x58,0x58,0x58,0x58,0x08,0x07,0x07
647 ,0x07,0x07,0x65,0x09,0x07,0x07,0x58,0x28,0x7b,0x28,0x28,0x7b,0x7b,0x7b
648 ,0x28,0x28,0x7b,0x7b,0x08,0x08,0x58,0x58,0x7b,0x08,0x08,0x08,0x58,0x58
649 ,0x58,0x08,0x07,0x07,0x07,0x07,0x65,0x09,0x07,0x07,0x08,0x58,0x28,0x28
650 ,0x28,0x7b,0x7b,0x28,0x28,0x7b,0x7b,0x08,0x08,0x08,0x58,0x28,0x28,0x58
651 ,0x08,0x58,0x58,0x58,0x08,0x07,0x07,0x07,0x07,0x07,0x13,0x09,0x07,0x7b
652 ,0x08,0x08,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x08,0x08,0x08
653 ,0x58,0x28,0x28,0x58,0x08,0x08,0x08,0x08,0x08,0x07,0x07,0x07,0x07,0x65
654 ,0x13,0x09,0x7b,0x7b,0x08,0x58,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x7b
655 ,0x7b,0x08,0x08,0x58,0x58,0x58,0x28,0x08,0x08,0x08,0x08,0x08,0x08,0x07
656 ,0x07,0x07,0x65,0x65,0x13,0x09,0x7b,0x7b,0x7b,0x28,0x28,0x7b,0x7b,0x58
657 ,0x58,0x28,0x7b,0x7b,0x7b,0x28,0x08,0x08,0x58,0x58,0x28,0x08,0x08,0x08
658 ,0x08,0x08,0x08,0x08,0x07,0x07,0x65,0x13,0x09,0x13,0x7b,0x7b,0x28,0x28
659 ,0x28,0x28,0x7b,0x7b,0x58,0x58,0x7b,0x7b,0x28,0x28,0x08,0x08,0x08,0x08
660 ,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x09,0x65,0x13,0x13,0x65,0x13
661 ,0x07,0x7b,0x58,0x58,0x28,0x7b,0x7b,0x7b,0x58,0x58,0x58,0x28,0x28,0x28
662 ,0x08,0x08,0x08,0x08,0x08,0x08,0x58,0x58,0x28,0x28,0x08,0x08,0x09,0x13
663 ,0x13,0x65,0x65,0x13,0x7b,0x7b,0x7b,0x58,0x58,0x28,0x7b,0x7b,0x58,0x58
664 ,0x58,0x58,0x58,0x58,0x08,0x08,0x08,0x08,0x08,0x08,0x58,0x58,0x58,0x28
665 ,0x28,0x28,0x08,0x09,0x09,0x09,0x09,0x65,0x08,0x7b,0x7b,0x58,0x58,0x28
666 ,0x28,0x28,0x58,0x58,0x58,0x58,0x28,0x7b,0x28,0x58,0x08,0x08,0x08,0x08
667 ,0x08,0x58,0x28,0x28,0x28,0x28,0x28,0x09,0x13,0x65,0x65,0x65,0x58,0x7b
668 ,0x7b,0x7b,0x58,0x28,0x28,0x58,0x58,0x58,0x58,0x58,0x28,0x28,0x7b,0x58
669 ,0x08,0x08,0x08,0x08,0x08,0x08,0x58,0x28,0x28,0x28,0x09,0x09,0x13,0x13
670 ,0x13,0x09,0x58,0x7b,0x7b,0x28,0x28,0x28,0x28,0x58,0x58,0x58,0x58,0x58
671 ,0x28,0x7b,0x7b,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x58,0x58,0x08,0x08
672 ,0x09,0x09,0x09,0x09,0x09,0x09,0x07,0x28,0x28,0x28,0x28,0x28,0x7b,0x58
673 ,0x58,0x58,0x58,0x28,0x7b,0x28,0x08,0x08,0x08,0x08,0x28,0x28,0x08,0x58
674 ,0x58,0x28,0x08,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x07,0x28,0x58,0x28
675 ,0x28,0x28,0x7b,0x7b,0x28,0x28,0x58,0x7b,0x7b,0x7b,0x08,0x08,0x58,0x58
676 ,0x28,0x58,0x58,0x58,0x28,0x28,0x28,0x08,0x08,0x13,0x09,0x09,0x09,0x09
677 ,0x07,0x07,0x08,0x28,0x28,0x28,0x28,0x7b,0x7b,0x28,0x58,0x28,0x7b,0x7b
678 ,0x28,0x08,0x08,0x58,0x7b,0x08,0x58,0x58,0x28,0x28,0x28,0x08,0x08,0x07
679 ,0x13,0x09,0x09,0x09,0x07,0x07,0x58,0x28,0x28,0x7b,0x7b,0x7b,0x7b,0x28
680 ,0x58,0x58,0x28,0x28,0x28,0x08,0x08,0x08,0x28,0x08,0x08,0x58,0x58,0x58
681 ,0x08,0x08,0x07,0x07,0x07,0x13,0x09,0x09,0x07,0x07,0x28,0x7b,0x28,0x7b
682 ,0x28,0x7b,0x7b,0x58,0x08,0x08,0x08,0x08,0x28,0x08,0x08,0x08,0x58,0x08
683 ,0x08,0x08,0x58,0x08,0x08,0x07,0x07,0x07,0x07,0x13,0x13,0x09,0x07,0x07
684 ,0x28,0x7b,0x7b,0x7b,0x08,0x08,0x08,0x08,0x58,0x58,0x08,0x08,0x08,0x08
685 ,0x58,0x58,0x58,0x58,0x08,0x08,0x08,0x08,0x08,0x08,0x07,0x07,0x07,0x07
686 ,0x13,0x09,0x07,0x07,0x08,0x08,0x7b,0x7b,0x28,0x08,0x08,0x08,0x08,0x58
687 ,0x58,0x08,0x08,0x58,0x58,0x58,0x58,0x58,0x08,0x08,0x08,0x08,0x08,0x08
688 ,0x07,0x07,0x07,0x07,0x13,0x09,0x07,0x07,0x07,0x08,0x28,0x28,0x28,0x08
689 ,0x08,0x08,0x58,0x58,0x58,0x08,0x58,0x58,0x58,0x58,0x08,0x08,0x08,0x08
690 ,0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x13,0x09,0x07,0x07,0x07,0x07
691 ,0x28,0x28,0x28,0x08,0x58,0x08,0x08,0x08,0x08,0x28,0x58,0x58,0x28,0x28
692 ,0x08,0x58,0x08,0x08,0x08,0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x09
693 ,0x07,0x07,0x07,0x07,0x08,0x28,0x28,0x08,0x28,0x28,0x08,0x58,0x28,0x28
694 ,0x58,0x58,0x28,0x28,0x28,0x58,0x08,0x08,0x08,0x08,0x08,0x07,0x07,0x07
695 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x58,0x58,0x28,0x28
696 ,0x08,0x28,0x28,0x28,0x58,0x58,0x58,0x08,0x08,0x08,0x08,0x08,0x07,0x07
697 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x08
698 ,0x58,0x08,0x28,0x28,0x08,0x08,0x28,0x28,0x08,0x08,0x08,0x08,0x08,0x08
699 ,0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
700 ,0x07,0x07,0x07,0x07,0x07,0x28,0x28,0x58,0x58,0x08,0x18,0x18,0x08,0x08
701 ,0x08,0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
705 const unsigned char *textures
[] = {texture1
, texture2
, texture3
, texture4
};
709 memset(pixels
,0,SCREEN_WIDTH
* SCREEN_HEIGHT
* sizeof(uint32_t));
712 void clearPixelCounter()
714 memset(pixelCounter
,0,SCREEN_WIDTH
* SCREEN_HEIGHT
* sizeof(uint32_t));
717 void writePixelCounter()
719 printf("\npixel counter:\n");
721 for (int y
= 0; y
< SCREEN_HEIGHT
; ++y
)
723 for (int x
= 0; x
< SCREEN_WIDTH
; ++x
)
725 uint32_t count
= pixelCounter
[y
* SCREEN_WIDTH
+ x
];
727 if (count
!= 1) // each pixel should have been rendered only once
728 printf("error: pixel %d %d rendered %d times!\n",x
,y
,count
);
734 uint8_t rgbToIndex(uint8_t r
, uint8_t g
, uint8_t b
)
736 return (r
& 0b00000111) | ((g
& 0b00000111) << 3) | ((b
& 0b00000011) << 6);
739 uint8_t sampleImage(const unsigned char *image
, RCL_Unit x
, RCL_Unit y
)
743 x
= RCL_wrap(x
,RCL_UNITS_PER_SQUARE
);
744 y
= RCL_wrap(y
,RCL_UNITS_PER_SQUARE
);
747 image
[1] * ((image
[0] * x
) / RCL_UNITS_PER_SQUARE
) + (image
[0] * y
) /
748 RCL_UNITS_PER_SQUARE
;
750 return image
[2 + index
];
753 uint8_t addIntensity(uint8_t color
, int16_t intensity
)
755 uint8_t r
= color
& 0b00000111;
756 uint8_t g
= (color
& 0b00111000) >> 3;
757 uint8_t b
= (color
& 0b11000000) >> 6;
773 r
= (intensity
> r
) ? 0 : r
- intensity
;
774 g
= (intensity
> g
) ? 0 : g
- intensity
;
776 b
= intensity
> b
? 0 : b
- intensity
;
779 return rgbToIndex(r
,g
,b
);
782 RCL_Unit
textureAt(int16_t x
, int16_t y
)
784 if (x
>= 0 && x
< LEVEL_X_RES
&& y
>= 0 && y
< LEVEL_Y_RES
)
785 return levelTexture
[(LEVEL_Y_RES
- y
-1) * LEVEL_X_RES
+ x
];
790 RCL_Unit
floorHeightAt(int16_t x
, int16_t y
)
792 if (x
== 6 && (y
== 13 || y
== 14)) // moving lift
793 return ((RCL_absVal(-1 * (frame
% 64) + 32)) * RCL_UNITS_PER_SQUARE
) / 8;
795 if (x
>= 0 && x
< LEVEL_X_RES
&& y
>= 0 && y
< LEVEL_Y_RES
)
796 return (levelFloor
[(LEVEL_Y_RES
- y
-1) * LEVEL_X_RES
+ x
] * RCL_UNITS_PER_SQUARE
) / 8;
798 int a
= RCL_absVal(x
- LEVEL_X_RES
/ 2) - LEVEL_X_RES
/ 2;
799 int b
= RCL_absVal(y
- LEVEL_Y_RES
/ 2) - LEVEL_Y_RES
/ 2;
801 return (a
> b
? a
: b
) * RCL_UNITS_PER_SQUARE
;
804 RCL_Unit
ceilingHeightAt(int16_t x
, int16_t y
)
808 if (x
>= 0 && x
< LEVEL_X_RES
&& y
>= 0 && y
< LEVEL_Y_RES
)
809 v
= levelCeiling
[(LEVEL_Y_RES
- y
-1) * LEVEL_X_RES
+ x
];
811 return (v
* RCL_UNITS_PER_SQUARE
) / 8;
815 Draws a scaled sprite on screen in an optimized way. The sprite has to be
816 square in resolution.
818 void drawSpriteSquare(const unsigned char *sprite
, int16_t x
, int16_t y
, RCL_Unit depth
, int16_t size
)
820 if (size
< 0 || size
> 512 || // let's not mess up with the incoming array
821 sprite
[0] != sprite
[1]) // only draw square sprites
824 int16_t samplingIndices
[size
];
826 // optimization: precompute the indices
828 for (RCL_Unit i
= 0; i
< size
; ++i
)
829 samplingIndices
[i
] = (i
* sprite
[0]) / size
;
834 RCL_Unit step
= RCL_UNITS_PER_SQUARE
/ size
;
838 int16_t jTo
= size
- max(0,y
+ size
- SCREEN_HEIGHT
);
839 int16_t iTo
= size
- max(0,x
+ size
- SCREEN_WIDTH
);
841 for (RCL_Unit i
= max(-1 * x
,0); i
< iTo
; ++i
)
843 int16_t xPos
= x
+ i
;
845 if (zBuffer
[xPos
] <= depth
)
848 int16_t columnLocation
= 2 + samplingIndices
[i
] * sprite
[0];
850 for (RCL_Unit j
= max(-1 * y
,0); j
< jTo
; ++j
)
852 c
= sprite
[columnLocation
+ samplingIndices
[j
]];
854 if (c
!= TRANSPARENT_COLOR
)
855 pixels
[(y
+ j
) * SCREEN_WIDTH
+ xPos
] =
856 (((c
& 0b00000111) * 36) << 24) |
857 ((((c
& 0b00111000) >> 3) * 36) << 16) |
858 ((((c
& 0b11000000) >> 6) * 85) << 8);
864 Function for drawing a single pixel (like fragment shader). Bottleneck =>
865 should be as fast as possible.
867 void pixelFunc(RCL_PixelInfo
*pixel
)
869 if (pixel
->position
.x
< 0 || pixel
->position
.x
>= SCREEN_WIDTH
||
870 pixel
->position
.y
< 0 || pixel
->position
.y
>= SCREEN_HEIGHT
)
871 printf("error: writing outside screen! %d %d\n",pixel
->position
.x
,pixel
->position
.y
);
873 if (pixel
->position
.y
== MIDDLE_ROW
)
874 zBuffer
[pixel
->position
.x
] = pixel
->depth
;
879 c
= sampleImage(textures
[pixel
->hit
.type
],pixel
->texCoords
.x
,pixel
->texCoords
.y
);
881 c
= pixel
->isFloor
? 0b00010001 : 0b00001010;
883 // int intensity = pixel->depth - 8 * RCL_UNITS_PER_SQUARE;
884 int intensity
= pixel
->depth
- 8 * RCL_UNITS_PER_SQUARE
;
885 intensity
= intensity
< 0 ? 0 : intensity
;
886 intensity
= (intensity
* 32) / RCL_UNITS_PER_SQUARE
;
888 int32_t color
= palette
[c
];
890 int32_t r
= ((color
& 0xFF000000) >> 24) - intensity
;
894 int32_t g
= ((color
& 0x00FF0000) >> 16) - intensity
;
898 int32_t b
= ((color
& 0x0000FF00) >> 8) - intensity
;
902 int32_t index
= pixel
->position
.y
* SCREEN_WIDTH
+ pixel
->position
.x
;
905 int32_t c = 0x00000000;
909 c = sampleImage(textures[pixel->hit.type],pixel->hit.textureCoord,pixel->textureCoordY);
910 c = c << 24 | c << 16 | c << 8;
911 // c = pixel->isFloor ? 0xFF000000 : 0xF0000000;
914 c = pixel->isFloor ? 0x00FF0000 : 0x00F00000;
916 pixels
[index
] = r
| g
| b
;
917 pixelCounter
[index
]++;
922 RCL_RayConstraints c
;
927 RCL_renderComplex(camera
,floorHeightAt
,ceilingHeightAt
,textureAt
,c
);
929 RCL_Unit previousDepth
;
931 for (uint8_t i
= 0; i
< SPRITES
; ++i
)
933 // use Chebyshew distance instead Euclidean, it's faster
934 if (RCL_absVal(sprites
[i
].mPosition
.x
- camera
.position
.x
) > SPRITE_MAX_DISTANCE
)
937 if (RCL_absVal(sprites
[i
].mPosition
.y
- camera
.position
.y
) > SPRITE_MAX_DISTANCE
)
940 RCL_PixelInfo pos
= RCL_mapToScreen(sprites
[i
].mPosition
,sprites
[i
].mHeight
,camera
);
944 drawSpriteSquare(sprites[i].mImage,pos.position.x,pos.position.y,
945 pos.depth,perspectiveScale(sprites[i].mPixelSize,pos.depth));
947 /* trick: sort the sprites by distance with bubble sort as we draw - the
948 order will be correct in a few frames */
949 if (i
!= 0 && pos
.depth
> previousDepth
)
951 Sprite tmp
= sprites
[i
];
952 sprites
[i
] = sprites
[i
- 1];
953 sprites
[i
- 1] = tmp
;
956 previousDepth
= pos
.depth
;
962 for (int i
= 0; i
< SCREEN_WIDTH
; ++i
)
965 for (uint8_t r
= 0; r
< 8; ++r
)
966 for (uint8_t g
= 0; g
< 8; ++g
)
967 for (uint8_t b
= 0; b
< 4; ++b
)
968 palette
[rgbToIndex(r
,g
,b
)] = ((36 * r
) << 24) | ((36 * g
) << 16) | ((85 * b
) << 8);
970 #define placeSprite(i,s,X,Y,z,n)\
971 sprites[i].mImage = s;\
972 sprites[i].mPosition.x = X * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2;\
973 sprites[i].mPosition.y = Y * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2;\
974 sprites[i].mHeight = z * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2;\
975 sprites[i].mPixelSize = n;
977 placeSprite(0,sprite1
,10,5,1,1000);
978 placeSprite(1,sprite1
,14,5,1,1000);
979 placeSprite(2,sprite2
,15,19,1,1500);
980 placeSprite(3,sprite3
,8,2,1,3000);
981 placeSprite(4,sprite3
,20,5,1,3000);
982 placeSprite(5,sprite3
,26,18,1,3000);
983 placeSprite(6,sprite3
,16,12,1,3000);
986 camera
.position
.x
= RCL_UNITS_PER_SQUARE
* 5;
987 camera
.position
.y
= RCL_UNITS_PER_SQUARE
* 4;
989 camera
.direction
= 0;
990 camera
.height
= RCL_UNITS_PER_SQUARE
* 2;
991 camera
.resolution
.x
= SCREEN_WIDTH
;
992 camera
.resolution
.y
= SCREEN_HEIGHT
;
994 SDL_Window
*window
= SDL_CreateWindow("raycasting", SDL_WINDOWPOS_UNDEFINED
, SDL_WINDOWPOS_UNDEFINED
, SCREEN_WIDTH
, SCREEN_HEIGHT
, SDL_WINDOW_SHOWN
);
995 SDL_Renderer
*renderer
= SDL_CreateRenderer(window
,-1,0);
996 SDL_Texture
*texture
= SDL_CreateTexture(renderer
,SDL_PIXELFORMAT_RGBX8888
, SDL_TEXTUREACCESS_STATIC
, SCREEN_WIDTH
, SCREEN_HEIGHT
);
997 SDL_Surface
*screenSurface
= SDL_GetWindowSurface(window
);
1006 clearPixelCounter();
1012 writePixelCounter();
1013 printf("cam: x = %d, y = %d, z = %d, r = %d, s = %d\n",
1024 SDL_UpdateTexture(texture
,NULL
,pixels
,SCREEN_WIDTH
* sizeof(uint32_t));
1026 while (SDL_PollEvent(&event
))
1036 switch (event
.key
.keysym
.scancode
)
1038 case SDL_SCANCODE_ESCAPE
: running
= 0; break;
1039 case SDL_SCANCODE_UP
: keyIndex
= KEY_UP
; break;
1040 case SDL_SCANCODE_RIGHT
: keyIndex
= KEY_RIGHT
; break;
1041 case SDL_SCANCODE_DOWN
: keyIndex
= KEY_DOWN
; break;
1042 case SDL_SCANCODE_LEFT
: keyIndex
= KEY_LEFT
; break;
1043 case SDL_SCANCODE_Q
: keyIndex
= KEY_Q
; break;
1044 case SDL_SCANCODE_W
: keyIndex
= KEY_W
; break;
1045 case SDL_SCANCODE_A
: keyIndex
= KEY_A
; break;
1046 case SDL_SCANCODE_S
: keyIndex
= KEY_S
; break;
1060 keys
[keyIndex
] = newState
;
1066 RCL_Vector2D direction
= RCL_angleToDirection(camera
.direction
);
1073 camera
.position
.x
+= step
* direction
.x
;
1074 camera
.position
.y
+= step
* direction
.y
;
1076 else if (keys
[KEY_DOWN
])
1078 camera
.position
.x
-= step
* direction
.x
;
1079 camera
.position
.y
-= step
* direction
.y
;
1083 camera
.height
+= step
* 100;
1084 else if (keys
[KEY_W
])
1085 camera
.height
-= step
* 100;
1087 if (keys
[KEY_RIGHT
])
1088 camera
.direction
+= step2
;
1089 else if (keys
[KEY_LEFT
])
1090 camera
.direction
-= step2
;
1092 const int shearAdd
= 10;
1095 camera
.shear
= camera
.shear
+ shearAdd
<= SCREEN_HEIGHT
? camera
.shear
+ shearAdd
: SCREEN_HEIGHT
;
1096 else if (keys
[KEY_S
])
1097 camera
.shear
= camera
.shear
- shearAdd
>= -1 * SCREEN_HEIGHT
? camera
.shear
- shearAdd
: -1 * SCREEN_HEIGHT
;
1099 SDL_RenderClear(renderer
);
1100 SDL_RenderCopy(renderer
,texture
,NULL
,NULL
);
1101 SDL_RenderPresent(renderer
);