|
|
|
|
32
|
if (direction == WEST) {
|
32
|
if (direction == WEST) {
|
33
|
dprintf("WEST with from: %d\n", roleFrom);
|
33
|
dprintf("WEST with from: %d\n", roleFrom);
|
34
|
if(roleFrom == BEHAVIOR_STAIR_WEST) {
|
34
|
if(roleFrom == BEHAVIOR_STAIR_WEST) {
|
|
|
35
|
+
|
35
|
//walk up the stair to the west
|
36
|
//walk up the stair to the west
|
36
|
dummyNpc.from.y--;
|
37
|
dummyNpc.from.y--;
|
37
|
dummyNpc.to.y--;
|
38
|
dummyNpc.to.y--;
|
38
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y-1, direction);
|
39
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y-1, direction);
|
39
|
dprintf("trying NW: %d\n", altBlocked);
|
40
|
dprintf("trying NW: %d\n", altBlocked);
|
40
|
- return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_NW : altBlocked;
|
|
|
|
|
41
|
+ u8 roleStairTo = cur_mapdata_block_role_at(x, y-1);
|
|
|
42
|
+ if(roleStairTo == BEHAVIOR_STAIR_WEST)
|
|
|
43
|
+ return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_NW : altBlocked;
|
41
|
}
|
44
|
}
|
42
|
else if(roleFrom == BEHAVIOR_STAIR_EAST){
|
45
|
else if(roleFrom == BEHAVIOR_STAIR_EAST){
|
43
|
//walk down the stair to the west
|
46
|
//walk down the stair to the west
|
44
|
dummyNpc.from.y++;
|
47
|
dummyNpc.from.y++;
|
45
|
dummyNpc.to.y++;
|
48
|
dummyNpc.to.y++;
|
46
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y+1, direction);
|
49
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y+1, direction);
|
47
|
- dprintf("trying SE: %d\n", altBlocked);
|
|
|
48
|
- return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_SW : altBlocked;
|
|
|
|
|
50
|
+ dprintf("trying SW: %d\n", altBlocked);
|
|
|
51
|
+ u8 roleStairTo = cur_mapdata_block_role_at(x, y+1);
|
|
|
52
|
+ if(roleStairTo == BEHAVIOR_STAIR_EAST)
|
|
|
53
|
+ return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_SW : altBlocked;
|
49
|
}
|
54
|
}
|
50
|
} else if(direction == EAST) {
|
55
|
} else if(direction == EAST) {
|
51
|
if(roleFrom == BEHAVIOR_STAIR_EAST) {
|
56
|
if(roleFrom == BEHAVIOR_STAIR_EAST) {
|
|
|
|
|
54
|
dummyNpc.to.y--;
|
59
|
dummyNpc.to.y--;
|
55
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y-1, direction);
|
60
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y-1, direction);
|
56
|
dprintf("trying NE: %d\n", altBlocked);
|
61
|
dprintf("trying NE: %d\n", altBlocked);
|
57
|
- return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_NE : altBlocked;
|
|
|
|
|
62
|
+ u8 roleStairTo = cur_mapdata_block_role_at(x, y-1);
|
|
|
63
|
+ dprintf("x: %d, y: %d, roleStairTo: %d\n",x, dummyNpc.to.y, roleStairTo);
|
|
|
64
|
+ if(roleStairTo == BEHAVIOR_STAIR_EAST)
|
|
|
65
|
+ return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_NE : altBlocked;
|
|
|
66
|
+
|
58
|
} else if (roleFrom == BEHAVIOR_STAIR_WEST) {
|
67
|
} else if (roleFrom == BEHAVIOR_STAIR_WEST) {
|
59
|
//walk down the stair to the east
|
68
|
//walk down the stair to the east
|
60
|
dummyNpc.from.y++;
|
69
|
dummyNpc.from.y++;
|
61
|
dummyNpc.to.y++;
|
70
|
dummyNpc.to.y++;
|
62
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y+1, direction);
|
71
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y+1, direction);
|
63
|
dprintf("trying SW: %d\n", altBlocked);
|
72
|
dprintf("trying SW: %d\n", altBlocked);
|
64
|
- return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_SE : altBlocked;
|
|
|
|
|
73
|
+ u8 roleStairTo = cur_mapdata_block_role_at(x, y+1);
|
|
|
74
|
+ if(roleStairTo == BEHAVIOR_STAIR_WEST)
|
|
|
75
|
+ return (altBlocked == 0) ? BLOCK_STATE_SIDEWAY_SE : altBlocked;
|
65
|
}
|
76
|
}
|
66
|
}
|
77
|
}
|
67
|
|
78
|
|