| 7876 | } |
| 7877 | |
| 7878 | void cFodder::Map_PathCheck_Generate(int16& pX1, int16& pY1, int16& pX2, int16& pY2, int16& pColumnWidth, int16& pRowWidth) { |
| 7879 | int16 X = pX2 - pX1; |
| 7880 | |
| 7881 | int16 Y = pY2 - pY1; |
| 7882 | |
| 7883 | int16 Data28 = pX2; |
| 7884 | |
| 7885 | int16 X_Move, Y_Move; |
| 7886 | |
| 7887 | // Target to the left? |
| 7888 | if (X < 0) { |
| 7889 | X_Move = -pColumnWidth; |
| 7890 | X = -X; |
| 7891 | pColumnWidth = -1; |
| 7892 | } |
| 7893 | else { |
| 7894 | X_Move = pColumnWidth; |
| 7895 | pColumnWidth = 1; |
| 7896 | } |
| 7897 | |
| 7898 | //loc_2A56A |
| 7899 | // If target position is above us |
| 7900 | if (Y < 0) { |
| 7901 | Y_Move = -pRowWidth; |
| 7902 | Y = -Y; |
| 7903 | pRowWidth = -1; |
| 7904 | } else { |
| 7905 | Y_Move = pRowWidth; |
| 7906 | pRowWidth = 1; |
| 7907 | } |
| 7908 | |
| 7909 | //loc_2A59D |
| 7910 | pX2 = 0; |
| 7911 | if (Y == 0) |
| 7912 | pX2 = 1; |
| 7913 | else |
| 7914 | pX2 = 0; |
| 7915 | |
| 7916 | pX2 = -pX2; |
| 7917 | |
| 7918 | mMap_PathToDest.clear(); |
| 7919 | |
| 7920 | loc_2A5BA:; |
| 7921 | |
| 7922 | // Reached target? |
| 7923 | if (Data28 == pX1 && pY2 == pY1) |
| 7924 | return; |
| 7925 | |
| 7926 | // Move up/down |
| 7927 | if (pX2 >= 0) { |
| 7928 | pY1 += pRowWidth; |
| 7929 | pX2 -= X; |
| 7930 | mMap_PathToDest.push_back(Y_Move); |
| 7931 | goto loc_2A5BA; |
| 7932 | } |
| 7933 | |
| 7934 | // Move left/right |
| 7935 | //loc_2A601 |