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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#include "../textures/textures.ppm" // текстуры
#include "../textures/warpclouds960640pixelated.ppm"
#include "../textures/barrel_goo_anim32.ppm"
#define MAPX 16 // размер (массива) карты по X
#define MAPY 16 // размер (массива) карты по Y
struct player
{ float x, y, dx, dy, th; };
struct player P = {50, 50, 0, 0, 0}; // начальные параметры игрока
struct sprite
{
int type, state, texture, opacity;
float x, y, z, scaleV, scaleH, offset;
};
struct sprite sp[] = {{0, 1, 0, 128, 40, 180, 20, 1, 1, 32, },
{0, 1, 0, 128, 448, 256, 20, 1, 1, 0, },
{0, 1, 0, 128, 448, 288, 20, 2, 2, 256,}};
// список спрайтов
int layoutW[MAPX*MAPY] = // массив стен
{
/* 10 12 14 */
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,//0
3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,//1
3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,//2
3,0,0,0,4,0,0,0,0,0,0,0,0,0,0,3,//3
3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,//4
3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,//5
3,3,3,3,3,2,3,3,2,3,3,2,3,0,0,3,//6
3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,//7
3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,//8
3,3,4,3,3,2,3,3,2,3,3,2,3,0,0,3,//9
3,0,0,0,3,3,3,3,3,5,5,5,3,0,0,3,//10
3,3,0,3,3,0,0,0,0,0,0,5,3,0,0,3,//11
3,0,0,0,3,0,3,3,3,0,0,5,3,0,0,3,//12
3,3,0,3,3,0,3,3,3,3,3,3,3,0,0,3,//13
3,0,0,0,3,0,0,0,0,0,0,0,4,0,0,3,//14
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,//15
/*0,1,2,3,4,5,6,7,8,9, 11 13 15*/
};
int layoutF[MAPX*MAPY] = // массив текстур пола
{
/* 10 12 14 */
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//0
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//1
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//2
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//3
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//4
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//5
0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,//6
1,1,1,0,0,1,0,0,1,0,0,1,0,2,2,2,//7
1,1,1,0,0,1,0,0,1,0,0,1,0,2,2,2,//8
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//9
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//10
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//11
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//12
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//13
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//14
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,//15
/*0,1,2,3,4,5,6,7,8,9, 11 13 15*/
};
int layoutC[MAPX*MAPY] = // массив потолка
{
/* 10 12 14 */
1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,//0
1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,//1
1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,//2
1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,//3
1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,//4
1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,//5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