`roomdata[roomy][roomx]` is a 1D array with all the tiles for the current room (the variables `roomx` and `roomy` are the current room's coordinates, and they start at 0). The tiles in the room are numbered starting at 1, so the 3rd tile from the left and top is `roomdata[roomy][roomx][(2*40)+(2+1)]`.