For each corner, the coordinates are tested against two adjacent edges. For example, if a location is both at the left edge of the map and at the top edge of the map, then it is a corner.
Here's the code for the different corners. Note that the 2nd coordinate appears to be scaled.
Initial data:
eax == (coordinate1)
ecx == (coordinate2)
esi == 1 for small maps
esi == 2 for medium and large maps
dword[esp] == (length of long edge of the map) - (esi)
ebp == 5 x (length of short edge of the map) - (esi)
Code: Select all
---------
:004B2F88 39F1 cmp ecx, esi // 1st corner
:004B2F8A 7D04 jge 004B2F90
:004B2F8C 39F0 cmp eax, esi
:004B2F8E 7C3B jl 004B2FCB // reject coordinates
---------
:004B2F90 39F1 cmp ecx, esi // 2nd corner
:004B2F92 7D05 jge 004B2F99
:004B2F94 3B0424 cmp eax, dword[esp]
:004B2F97 7D32 jge 004B2FCB // reject coordinates
---------
:004B2F99 39E9 cmp ecx, ebp // 3rd corner
:004B2F9B 7C04 jl 004B2FA1
:004B2F9D 39F0 cmp eax, esi
:004B2F9F 7C2A jl 004B2FCB // reject coordinates
---------
:004B2FA1 39E9 cmp ecx, ebp // 4th corner
:004B2FA3 7C05 jl 004B2FAA // ACCEPT coordinates
:004B2FA5 3B0424 cmp eax, dword[esp]
:004B2FA8 7D21 jge 004B2FCB // reject coordinates
---------
Also, the code of the subroutine which calls sub_4B2F20 suggests that if this test fails a hundred times, it is not performed again. This would mean that it IS possible (albeit very improbable) to start in a corner in vanilla BotF.