View.Set ("graphics:max,max") % Declare the terrain constants const NORMAL := 1 const GRASS := 2 const FOREST := 3 const MOUNTAIN := 4 const ROAD := 5 const SHALLOW := 6 const WATER := 7 const SHORE := 8 var terrainTypes : array 1 .. 8 of int := init (49, 48, 2, 66, 15, 53, 55, 91) var map : array 1 .. 100, 1 .. 100 of int var mx, my, mb, terrType : int := 1 proc initializeMap for i : 1 .. 100 for j : 1 .. 100 map (i, j) := 2 end for end for end initializeMap proc initializeEditor for i : 1 .. 2 for j : 1 .. 4 if i = 1 then drawfillbox (25 + (i * 25), 100 + (j * 25), 50 + (i * 25), 125 + (j * 25), terrainTypes (j)) else drawfillbox (25 + (i * 25), 100 + (j * 25), 50 + (i * 25), 125 + (j * 25), terrainTypes (4 + j)) end if end for end for end initializeEditor proc changeTerrType (mx, my, terrType : int) map ((mx - 100) div 16, (my - 100) div 16) := terrType end changeTerrType proc drawMap for i : 1 .. 40 for j : 1 .. 40 drawfillbox (100 + i * 16, 100 + j * 16, 100 + i * 16 + 16, 100 + j * 16 + 16, terrainTypes (map (i, j))) end for end for end drawMap initializeMap initializeEditor drawMap loop mousewhere (mx, my, mb) locate (1, 1) put mx, " ", my locate (1, 10) put terrType if mx > 50 and my > 125 and mx < 100 and my < 225 and mb = 1 then if mx < 75 then terrType := 1 + (my - 125) div 25 else terrType := 5 + ((my - 125) div 25) end if end if if mx > 116 and my > 115 and mx < 758 and my < 756 and mb = 1 then changeTerrType (mx, my, terrType) drawMap end if end loop