|
@@ -32,20 +32,25 @@ u8 npc_get_walkable_status(struct NpcState *npc, u16 x, u16 y, enum Direction di
|
32
|
32
|
if (direction == WEST) {
|
33
|
33
|
dprintf("WEST with from: %d\n", roleFrom);
|
34
|
34
|
if(roleFrom == BEHAVIOR_STAIR_WEST) {
|
|
35
|
+
|
35
|
36
|
//walk up the stair to the west
|
36
|
37
|
dummyNpc.from.y--;
|
37
|
38
|
dummyNpc.to.y--;
|
38
|
39
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y-1, direction);
|
39
|
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
|
45
|
else if(roleFrom == BEHAVIOR_STAIR_EAST){
|
43
|
46
|
//walk down the stair to the west
|
44
|
47
|
dummyNpc.from.y++;
|
45
|
48
|
dummyNpc.to.y++;
|
46
|
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
|
55
|
} else if(direction == EAST) {
|
51
|
56
|
if(roleFrom == BEHAVIOR_STAIR_EAST) {
|
|
@@ -54,14 +59,20 @@ u8 npc_get_walkable_status(struct NpcState *npc, u16 x, u16 y, enum Direction di
|
54
|
59
|
dummyNpc.to.y--;
|
55
|
60
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y-1, direction);
|
56
|
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
|
67
|
} else if (roleFrom == BEHAVIOR_STAIR_WEST) {
|
59
|
68
|
//walk down the stair to the east
|
60
|
69
|
dummyNpc.from.y++;
|
61
|
70
|
dummyNpc.to.y++;
|
62
|
71
|
u8 altBlocked = npc_block_way(&dummyNpc, x,y+1, direction);
|
63
|
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
|
|