5 const uint16_t _floorheights
[6] = {0, 12800, 15360, 17000, 20000, 25000 };
7 const uint8_t _floor_height
[256] = {
8 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5
11 const uint8_t _tunnel_inner
[38] = {
12 16, 16, 16, 16, 15, 14, 13, 11,
13 8, 7, 6, 5, 3, 3, 3, 3,
14 3, 3, 2, 1, 0, 0, 0, 0,
15 0, 0, 1, 2, 3, 3, 3, 3,
19 const uint8_t _tunnel_outer
[38] = {
20 32, 32, 32, 32, 32, 32, 32, 32,
21 32, 32, 32, 32, 32, 32, 32, 32,
22 32, 31, 31, 31, 31, 31, 30, 30,
23 30, 29, 29, 29, 28, 27, 26, 25,
24 24, 22, 20, 18, 17, 14
27 int tile::apparent_height() throw()
29 if((_tile
& 0xE00) <= 0x400)
30 return (_tile
& 0xF00) >> 9;
34 bool tile::is_colliding_floor(int16_t hchunk
, int16_t vpos
)
36 return has_lower_floor() && vpos
> 7808 && vpos
< 10240;
38 bool tile::is_colliding(int16_t hchunk
, int16_t vpos
)
42 if(vpos
<= 8576 || hchunk
> 37)
45 if((_tile
& 0xE00) >= 0x600)
48 if((_tile
& 0x100) != 0) {
49 int16_t rvpos
= vpos
- 8704;
50 if(rvpos
>= 0 && rvpos
< (128 * _tunnel_inner
[hchunk
]))
54 if((_tile
& 0xE00) == 0x400 && vpos
>= 15360)
56 if((_tile
& 0xE00) == 0x200 && vpos
>= 12800)
58 if((_tile
& 0xF00) == 0 && vpos
>= 10240)
60 //The bare turnnel special.
61 if((_tile
& 0xF00) == 0x100) {
62 int16_t rvpos
= vpos
- 8704;
63 if(rvpos
>= 0 && rvpos
>= (128 * _tunnel_outer
[hchunk
]))
68 int16_t tile::upper_level()
70 return _floorheights
[_floor_height
[_tile
>> 8]];
72 unsigned tile::surface_type(int16_t vpos
)
76 else if(vpos
== upper_level())
81 bool tile::is_dangerous()
83 if((_tile
& 0xF00) == 0)
84 return ((_tile
& 0xF) == 0x00 || (_tile
& 0xF) == 0xC);
85 if((_tile
& 0xF00) == 0x100)
87 return ((_tile
& 0xF0) == 0xC0);
89 bool tile::in_pipe(uint16_t hchunk
, int16_t vpos
)
91 if(hchunk
> 23 || !is_tunnel())
93 return (vpos
- 8704 < ((_tunnel_inner
[hchunk
] + _tunnel_outer
[hchunk
]) / 2) * 128);