private int fnWalk(SwordObject cpt, int id, int x, int y, int dir, int stance, int a, int b)
{
if (stance > 0)
dir = 9;
cpt.walk_pc = 0;
cpt.route[1].frame = 512; // end of sequence
if (id == PLAYER)
_router.SetPlayerTarget(x, y, dir, stance);
int routeRes = _router.RouteFinder(id, cpt, x, y, dir);
if (id == PLAYER)
{
if ((routeRes == 1) || (routeRes == 2))
{
ScriptVars[(int)ScriptVariableNames.MEGA_ON_GRID] = 0;
ScriptVars[(int)ScriptVariableNames.REROUTE_GEORGE] = 0;
}
}
if ((routeRes == 1) || (routeRes == 2))
{
cpt.down_flag = 1; // 1 means okay.
// if both mouse buttons were pressed on an exit => skip george's walk
if ((id == GEORGE) && (_mouse.TestEvent() == Mouse.MOUSE_BOTH_BUTTONS))
{
int target = (int)ScriptVars[(int)ScriptVariableNames.CLICK_ID];
// exceptions: compacts that use hand pointers but are not actually exits
if ((target != LEFT_SCROLL_POINTER) && (target != RIGHT_SCROLL_POINTER) &&
(target != FLOOR_63) && (target != ROOF_63) && (target != GUARD_ROOF_63) &&
(target != LEFT_TREE_POINTER_71) && (target != RIGHT_TREE_POINTER_71))
{
target = _objMan.FetchObject(ScriptVars[(int)ScriptVariableNames.CLICK_ID]).mouse_on;
if ((target >= SCR_exit0) && (target <= SCR_exit9))
{
fnStandAt(cpt, id, x, y, dir, stance, 0, 0);
return SCRIPT_STOP;
}
}
}
cpt.logic = LOGIC_AR_animate;
return SCRIPT_STOP;
}
else if (routeRes == 3)
cpt.down_flag = 1; // pretend it was successful
else
cpt.down_flag = 0; // 0 means error
return SCRIPT_CONT;
}