-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpg_npcs.zh
81 lines (74 loc) · 1.92 KB
/
rpg_npcs.zh
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
namespace npcs
{
bool canWalk(npc T, int step, int dir)
{
switch(dir)
{
case DIR_UP:
{
if (!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+(T->TileWidth*4),
scroll.yPos+T->Y-step+56) )
&& //corners
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X,
scroll.yPos+T->Y-step+56) )
&&
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+(T->TileWidth*8)-1,
scroll.yPos+T->Y-step+56) )
)
{
return true;
}
return false;
}
case DIR_DOWN:
{
if (!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+(T->TileWidth*4),
scroll.yPos+T->Y +15+ step+56))
&& //corners
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X,
scroll.yPos+T->Y +15+ step+56))
&&
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+(T->TileWidth*8)-1,
scroll.yPos+T->Y +15+ step+56))
)
{
return true;
}
return false;
}
case DIR_LEFT:
{
if(!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X-step,
scroll.yPos+T->Y+56+(T->TileHeight*4)) )
&& //corners
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X-step,
scroll.yPos+T->Y+56) )
&&
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X-step,
scroll.yPos+T->Y+56+(T->TileHeight*8)-1) )
)
{
return true;
}
return false;
}
case DIR_RIGHT:
{
if(!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+15+step,
scroll.yPos+T->Y+56+(T->TileHeight*4)) )
&& //corners
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+15+step,
scroll.yPos+T->Y+56) )
&&
!(Graphics->GetPixel(bitmaps.overscan_solid,scroll.xPos+T->X+15+step,
scroll.yPos+T->Y+56+(T->TileHeight*8)-1) )
)
{
return true;
}
return false;
}
default: return false;
}
}
}