static void map1_common(unsigned char *data, int len, int rev){ int mask, x, y, pos = 0, layer; int darkness; int faces[MAXLAYERS]; map1cmd=1; if (!mapupdatesent) /* see MapExtendedCmd */ display_map_startupdate(); while (pos <len) { mask = GetShort_String(data+pos); pos+=2; x = (mask >>10) & 0x3f; y = (mask >>4) & 0x3f; /* If there are no low bits (face/darkness), this space is * not visible. */ if ((mask & 0xf) == 0) { mapdata_set_face(x, y, -1, -1, -1, -1); continue; /* if empty mask, none of the checks will be true. */ } /* If this space was previously stored for fog of war, need to clear * it now. Needs to be done before anything else happens that we * might want to store in it. */ if (mask & 0x8) { /* darkness bit */ darkness = data[pos++]; } else { darkness = -1; } /* Reduce redundant by putting the get image * and flags in a common block. The layers * are the inverse of the bit order unfortunately. */ for (layer=NUM_LAYERS; layer>=0; layer--) { if (mask & (1 << layer)) { faces[NUM_LAYERS-layer] = GetShort_String(data+pos); pos +=2; } else { faces[NUM_LAYERS-layer] = -1; } } mapdata_set_face(x, y, darkness, faces[0], faces[1], faces[2]); } mapupdatesent=0; display_map_doneupdate(FALSE, FALSE);}