there is some errors :
uint zoneX=cr.WorldX/__GlobalMapZoneLength;
uint zoneY=cr.WorldY/__GlobalMapZoneLength;
for(zoneX=0;zoneX<=Q;zoneX++)
{
for(zoneY=0;zoneY<=Z;zoneY++)
...
zoneX and zoneY is affect by a value and after in "for loop" it's re-affected to 0.
Q and Z are never affected.
And I don't see the point to stop at the critter location. Just set "fog half" on the whole map and set where the critter is to "fog none".