42 #define DEBUG_ARROW (0)
47 #define SET_SCOLOR(sf) \
48 if (check_color[sf]) { \
49 tx = points[sf][i][X] - gsurfs[sf]->x_trans; \
50 ty = points[sf][i][Y] - gsurfs[sf]->y_trans; \
51 offset = XY2OFF(gsurfs[sf], tx, ty); \
52 colors[sf] = gs_mapcolor(cobuf[sf], coloratt[sf], offset); \
56 static int get_point_below(
Point3 **,
geosurf **,
int,
int,
int,
int *);
141 int check_mask, check_color, check_transp;
142 int check_material, check_emis, check_shin;
143 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
144 int xmod, ymod, row, col, cnt, xcnt, ycnt;
145 long offset, y1off, y2off;
146 float x1, x2, y1, y2, tx, ty, tz, ttr;
147 float n[3], pt[4], xres, yres, ymax, zexag;
148 int em_src, sh_src, trans_src, col_src, curcolor;
149 gsurf_att *ematt, *shatt, *tratt, *coloratt;
152 GLdouble modelMatrix[16], projMatrix[16];
157 float sz, mag, tedge1[3], tedge2[3], crossp[3], triv[3][3];
158 double asurf = 0.0, axsurf = 0.0;
161 int zeros, dr1, dr2, dr3, dr4;
162 int datarow1, datacol1, datarow2, datacol2;
164 float kem, ksh, pkem, pksh;
167 G_debug(3,
"gsd_surf_map_old");
185 check_mask = surf->
curmask ? 1 : 0;
193 xres = xmod * surf->
xres;
194 yres = ymod * surf->
yres;
195 ymax = (surf->
rows - 1) * surf->
yres;
203 window[0] += (int)(yres * 2);
204 window[1] -= (int)(yres * 2);
205 window[2] -= (int)(xres * 2);
206 window[3] += (int)(xres * 2);
231 ktrans = (255U << 24);
239 else if (
MAP_ATT == trans_src) {
241 check_transp = trbuff ? 1 : 0;
257 check_emis = embuff ? 1 : 0;
272 check_shin = shbuff ? 1 : 0;
292 check_material = (check_shin || check_emis || (kem && check_color));
298 for (row = 0; row < ycnt; row++) {
307 datarow1 = row * ymod;
308 datarow2 = (row + 1) * ymod;
310 y1 = ymax - row * yres;
311 y2 = ymax - (row + 1) * yres;
312 y1off = row * ymod * surf->
cols;
313 y2off = (row + 1) * ymod * surf->
cols;
318 dr1 = dr2 = dr3 = dr4 = 1;
346 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
347 ktrans = (char)(255U - ktrans) << 24;
371 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
372 ktrans = (char)(255U - ktrans) << 24;
375 if (check_material) {
386 if (pksh != ksh || pkem != kem || (kem && check_color)) {
404 for (col = 0; col < xcnt; col++) {
405 datacol1 = col * xmod;
406 datacol2 = (col + 1) * xmod;
409 x2 = (col + 1) * xres;
412 dr1 = dr2 = dr3 = dr4 = 1;
435 if ((zeros > 1) && cnt) {
450 offset = y1off + datacol1;
471 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
472 ktrans = (char)(255U - ktrans) << 24;
475 if (check_material) {
486 if (pksh != ksh || pkem != kem ||
487 (kem && check_color)) {
505 offset = y2off + datacol1;
526 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
527 ktrans = (char)(255U - ktrans) << 24;
530 if (check_material) {
541 if (pksh != ksh || pkem != kem ||
542 (kem && check_color)) {
561 offset = y1off + datacol2;
582 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
583 ktrans = (char)(255U - ktrans) << 24;
586 if (check_material) {
597 if (pksh != ksh || pkem != kem || (kem && check_color)) {
630 offset = y2off + datacol2;
651 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
652 ktrans = (char)(255U - ktrans) << 24;
655 if (check_material) {
666 if (pksh != ksh || pkem != kem || (kem && check_color)) {
709 G_debug(5,
" Surface Area: %.12lf", asurf);
710 G_debug(5,
" Exaggerated Surface Area: %.12lf", axsurf);
731 int do_diff, check_mask, check_color;
733 int xmod, ymod, row, col, cnt, xcnt, ycnt;
734 long offset, y1off, y2off;
735 float x1, x2, y1, y2, tx, ty, tz;
736 float n[3], pt[4], xres, yres, ymax, zexag;
737 int col_src, curcolor;
741 GLdouble modelMatrix[16], projMatrix[16];
745 int zeros, dr1, dr2, dr3, dr4;
746 int datarow1, datacol1, datarow2, datacol2;
748 unsigned int ktrans = 255;
759 check_mask = surf->
curmask ? 1 : 0;
768 xres = xmod * surf->
xres;
769 yres = ymod * surf->
yres;
773 ymax = (surf->
rows - 1) * surf->
yres;
778 window[0] += (int)(yres * 2);
779 window[1] -= (int)(yres * 2);
780 window[2] -= (int)(xres * 2);
781 window[3] += (int)(xres * 2);
806 ktrans = (ktrans << 24);
833 if (!check_color && !check_mask && !do_diff) {
858 for (row = 0; row < ycnt; row++) {
867 datarow1 = row * ymod;
868 datarow2 = (row + 1) * ymod;
870 y1 = ymax - row * yres;
871 y2 = ymax - (row + 1) * yres;
872 y1off = row * ymod * surf->
cols;
873 y2off = (row + 1) * ymod * surf->
cols;
878 dr1 = dr2 = dr3 = dr4 = 1;
924 for (col = 0; col < xcnt; col++) {
925 datacol1 = col * xmod;
926 datacol2 = (col + 1) * xmod;
929 x2 = (col + 1) * xres;
932 dr1 = dr2 = dr3 = dr4 = 1;
955 if ((zeros > 1) && cnt) {
969 offset = y1off + datacol1;
994 offset = y2off + datacol1;
1020 offset = y1off + datacol2;
1045 offset = y2off + datacol2;
1112 int i, i1, i2, nlong, offset, col_src;
1113 int check_color1, check_color2, color1, color2;
1117 check_color1 = check_color2 = 1;
1156 for (nlong = (npts1 > npts2 ? npts1 : npts2), i = 0; i < nlong; i++) {
1157 i1 = i * npts1 / nlong;
1158 i2 = i * npts2 / nlong;
1159 offset =
XY2OFF(surf1, points1[i1][
X], points1[i1][
Y]);
1165 offset =
XY2OFF(surf1, points2[i2][
X], points2[i2][
Y]);
1172 if (npts1 > npts2) {
1230 static int transpoint_is_masked(
geosurf *surf,
Point3 point)
1255 static int get_point_below(
Point3 **points,
geosurf **gsurfs,
int ptn,
1256 int cursurf,
int numsurfs,
int *belowsurf)
1259 float nearz = 0.0, diff;
1261 if (gsurfs[cursurf]->curmask) {
1262 if (transpoint_is_masked(gsurfs[cursurf], points[cursurf][ptn])) {
1267 for (n = 0; n < numsurfs; ++n) {
1268 diff = points[cursurf][ptn][
Z] - points[n][ptn][
Z];
1271 if (!nearz || diff < nearz) {
1272 if (gsurfs[n]->curmask) {
1273 if (transpoint_is_masked(gsurfs[n], points[n][ptn])) {
1326 int n, i, offset, col_src, check_color[
MAX_SURFS];
1331 nocolor = FCmode ==
FC_GREY ? 1 : 0;
1334 for (n = 0; n < ns; ++n) {
1341 colors[n] = (int)gsurfs[n]->att[
ATT_COLOR].constant;
1380 int bn, bnl, ctop, cbot, ctopl, cbotl, bsret;
1384 ctop = cbot = ctopl = cbotl = color;
1387 for (n = 0; n < ns; ++n) {
1388 for (i = 0; i < np; i++) {
1390 (bsret = get_point_below(points, gsurfs, i, n, ns, &bn))) {
1398 ctop = cbot = colors[n];
1401 ctop = cbot = colors[bn];
1411 if (!transpoint_is_masked(gsurfs[n],
1412 points[n][i - 1]) &&
1413 !transpoint_is_masked(gsurfs[bn],
1414 points[bn][i - 1])) {
1416 1.0, points[n][i][
Z], 0.0,
1417 points[bn][i - 1][
Z], 1.0,
1418 points[bn][i][
Z], &tx,
1421 xing[
Y] = points[n][i - 1][
Y] +
1422 tx * (points[n][i][
Y] -
1423 points[n][i - 1][
Y]);
1424 xing[
X] = points[n][i - 1][
X] +
1425 tx * (points[n][i][
X] -
1426 points[n][i - 1][
X]);
1428 xing[
Z] = points[bn][i - 1][
Z] +
1429 tx * (points[bn][i][
Z] -
1430 points[bn][i - 1][
Z]);
1442 while (i < np && 0 < (bsret = get_point_below(
1443 points, gsurfs, i, n, ns, &bn))) {
1461 ctop = cbot = colors[n];
1464 ctop = cbot = colors[bn];
1495 if (bnl >= 0 && bnl != bn) {
1500 if (!transpoint_is_masked(gsurfs[n],
1501 points[n][i - 1]) &&
1502 !transpoint_is_masked(gsurfs[bnl],
1503 points[bnl][i - 1]) &&
1504 !transpoint_is_masked(gsurfs[bn],
1505 points[bn][i - 1])) {
1508 0.0, points[n][i - 1][
Z], 1.0,
1509 points[n][i][
Z], 0.0,
1510 points[bn][i - 1][
Z], 1.0,
1511 points[bn][i][
Z], &tx, &ty)) {
1516 "crossing going up at surf %d no. %d",
1521 xing[
Y] = points[n][i - 1][
Y] +
1522 tx * (points[n][i][
Y] -
1523 points[n][i - 1][
Y]);
1524 xing[
X] = points[n][i - 1][
X] +
1525 tx * (points[n][i][
X] -
1526 points[n][i - 1][
X]);
1529 xing[
Z] = points[bnl][i - 1][
Z] +
1530 tx * (points[bnl][i][
Z] -
1531 points[bnl][i - 1][
Z]);
1539 0.0, points[n][i - 1][
Z], 1.0,
1540 points[n][i][
Z], 0.0,
1541 points[bnl][i - 1][
Z], 1.0,
1542 points[bnl][i][
Z], &tx,
1548 "crossing going down at surf %d no. %d",
1553 xing[
Y] = points[n][i - 1][
Y] +
1554 tx * (points[n][i][
Y] -
1555 points[n][i - 1][
Y]);
1556 xing[
X] = points[n][i - 1][
X] +
1557 tx * (points[n][i][
X] -
1558 points[n][i - 1][
X]);
1561 xing[
Z] = points[bnl][i - 1][
Z] +
1562 tx * (points[bnl][i][
Z] -
1563 points[bnl][i - 1][
Z]);
1569 xing[
Z] = points[bn][i - 1][
Z] +
1570 tx * (points[bn][i][
Z] -
1571 points[bn][i - 1][
Z]);
1577 !transpoint_is_masked(gsurfs[bn],
1578 points[bn][i - 1]) &&
1579 !transpoint_is_masked(gsurfs[bnl],
1580 points[bnl][i - 1])) {
1583 0.0, points[bn][i - 1][
Z], 1.0,
1584 points[bn][i][
Z], 0.0,
1585 points[bnl][i - 1][
Z], 1.0,
1586 points[bnl][i][
Z], &tx, &ty)) {
1593 "lower crossing at surf %d no. %d "
1594 "between surfs %d & %d",
1598 xing[
Y] = points[bn][i - 1][
Y] +
1599 tx * (points[bn][i][
Y] -
1600 points[bn][i - 1][
Y]);
1601 xing[
X] = points[bn][i - 1][
X] +
1602 tx * (points[bn][i][
X] -
1603 points[bn][i - 1][
X]);
1605 z1 = xing[
Z] = points[n][i - 1][
Z] +
1606 tx * (points[n][i][
Z] -
1607 points[n][i - 1][
Z]);
1622 if (!upper && !lower) {
1623 G_debug(5,
"Crossing NOT found or masked:");
1625 " current surf: %d [ %.2f %.2f "
1626 "%.2f -> %.2f %.2f %f",
1627 n, points[n][i - 1][
X],
1628 points[n][i - 1][
Y],
1629 points[n][i - 1][
Z],
1630 points[n][i][
X], points[n][i][
Y],
1633 " below surf: %d [ %.2f %.2f %.2f "
1634 "-> %.2f %.2f %f\n",
1635 bn, points[bn][i - 1][
X],
1636 points[bn][i - 1][
Y],
1637 points[bn][i - 1][
Z],
1638 points[bn][i][
X], points[bn][i][
Y],
1641 gs
" last below surf: %d [ %.2f "
1642 "%.2f %.2f -> %.2f %.2f %f\n",
1643 bnl, points[bnl][i - 1][
X],
1644 points[bnl][i - 1][
Y],
1645 points[bnl][i - 1][
Z],
1662 if (!transpoint_is_masked(gsurfs[n],
1663 points[n][i - 1]) &&
1664 !transpoint_is_masked(gsurfs[bn],
1665 points[bn][i - 1])) {
1667 1.0, points[n][i][
Z], 0.0,
1668 points[bn][i - 1][
Z], 1.0,
1669 points[bn][i][
Z], &tx,
1672 xing[
Y] = points[n][i - 1][
Y] +
1673 tx * (points[n][i][
Y] -
1674 points[n][i - 1][
Y]);
1675 xing[
X] = points[n][i - 1][
X] +
1676 tx * (points[n][i][
X] -
1677 points[n][i - 1][
X]);
1714 int nsurfs, ret, npts, npts1, n, i,
err = 0;
1715 float bgn1[2], end1[2];
1717 if (norm[
Z] > 0.0001 || norm[
Z] < -.0001) {
1727 for (n = 0; n < nsurfs; n++) {
1736 if (npts != npts1) {
1737 G_warning(
_(
"Cut-plane points mis-match between surfaces. "
1738 "Check resolution(s)."));
1748 if (n == nsurfs - 1) {
1752 for (i = 0; i < npts1; i++) {
1754 points[n][i][
X] += gsurfs[n]->
x_trans;
1755 points[n][i][
Y] += gsurfs[n]->
y_trans;
1756 points[n][i][
Z] += gsurfs[n]->
z_trans;
1766 for (i = 0; i < npts1; i++) {
1767 GS_v3eq(points[n][i], tmp[i]);
1770 points[n][i][
X] += gsurfs[n]->
x_trans;
1771 points[n][i][
Y] += gsurfs[n]->
y_trans;
1772 points[n][i][
Z] += gsurfs[n]->
z_trans;
1777 for (n = 0; n < nsurfs; n++) {
1787 for (n = 0; n < nsurfs - 1; n++) {
1809 int xmod, ymod, row, col, cnt, xcnt, ycnt;
1810 long offset, y1off, y2off;
1811 float x2, y1, y2, tx, ty, tz, sz;
1812 float n[3], pt[4], xres, yres, ymax, zexag;
1814 #ifdef DO_ARROW_SOLID
1819 int check_color = 1;
1821 int zeros, dr1, dr2, dr3, dr4;
1822 int datarow1, datacol1, datarow2, datacol2;
1824 G_debug(3,
"gsd_norm_arrows");
1840 check_mask = surf->
curmask ? 1 : 0;
1842 #ifdef DO_ARROW_SOLID
1863 xres = xmod * surf->
xres;
1864 yres = ymod * surf->
yres;
1865 ymax = (surf->
rows - 1) * surf->
yres;
1877 #ifdef DO_ARROW_SOLID
1885 for (row = 0; row < ycnt; row++) {
1892 datarow1 = row * ymod;
1893 datarow2 = (row + 1) * ymod;
1895 y1 = ymax - row * yres;
1896 y2 = ymax - (row + 1) * yres;
1897 y1off = row * ymod * surf->
cols;
1898 y2off = (row + 1) * ymod * surf->
cols;
1901 dr1 = dr2 = dr3 = dr4 = 1;
1923 #ifdef DO_ARROW_SOLID
1928 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
1931 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
1944 #ifdef DO_ARROW_SOLID
1949 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
1952 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
1959 for (col = 0; col < xcnt; col++) {
1960 datacol1 = col * xmod;
1961 datacol2 = (col + 1) * xmod;
1964 x2 = (col + 1) * xres;
1967 dr1 = dr2 = dr3 = dr4 = 1;
1990 if ((zeros > 1) && cnt) {
1997 offset = y1off + datacol2;
2004 #ifdef DO_ARROW_SOLID
2009 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
2012 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
2020 offset = y2off + datacol2;
2027 #ifdef DO_ARROW_SOLID
2032 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
2035 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
2063 int check_color, check_transp;
2064 int check_material, check_emis, check_shin;
2065 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
2067 int row, col, xcnt, ycnt;
2068 long y1off, y2off, y3off;
2072 float x1, x2, x3, y1, y2, y3, tx, ty, tz, ttr;
2073 float n[3], pt[4], xres, yres, ymax, zexag;
2074 int em_src, sh_src, trans_src, col_src, curcolor;
2075 gsurf_att *ematt, *shatt, *tratt, *coloratt;
2078 GLdouble modelMatrix[16], projMatrix[16];
2082 int datacol1, datacol2, datacol3;
2086 float kem, ksh, pkem, pksh;
2087 unsigned int ktrans;
2116 xres = xmod * surf->
xres;
2117 yres = ymod * surf->
yres;
2118 ymax = (surf->
rows - 1) * surf->
yres;
2133 window[0] += (int)(yres * 4 * zexag);
2134 window[1] -= (int)(yres * 4 * zexag);
2135 window[2] -= (int)(xres * 4 * zexag);
2136 window[3] += (int)(xres * 4 * zexag);
2147 ktrans = (255U << 24);
2155 else if (
MAP_ATT == trans_src) {
2157 check_transp = trbuff ? 1 : 0;
2173 check_emis = embuff ? 1 : 0;
2188 check_shin = shbuff ? 1 : 0;
2208 check_material = (check_shin || check_emis || (kem && check_color));
2213 for (row = start_val; row < ycnt; row += step_val) {
2240 y1 = ymax - row * yres;
2241 y2 = ymax - (row - (step_val / 2)) * yres;
2242 y3 = ymax - (row + (step_val / 2)) * yres;
2244 y1off = row * ymod * surf->
cols;
2245 y2off = (row - (step_val / 2)) * ymod * surf->
cols;
2246 y3off = (row + (step_val / 2)) * ymod * surf->
cols;
2248 for (col = start_val; col < xcnt; col += step_val) {
2249 datacol1 = col * xmod;
2250 datacol2 = (col - (step_val / 2)) * xmod;
2251 datacol3 = (col + (step_val / 2)) * xmod;
2254 x2 = (col - (step_val / 2)) * xres;
2255 x3 = (col + (step_val / 2)) * xres;
2268 offset2[0] = y1off + datacol1;
2282 offset2[1] = y2off + datacol2;
2283 offset2[2] = y2off + datacol1;
2284 offset2[3] = y2off + datacol3;
2285 offset2[4] = y1off + datacol3;
2286 offset2[5] = y3off + datacol3;
2287 offset2[6] = y3off + datacol1;
2288 offset2[7] = y3off + datacol2;
2289 offset2[8] = y1off + datacol2;
2290 offset2[9] = y2off + datacol2;
2313 for (ii = 0; ii < 10; ii++) {
2326 curcolor =
gs_mapcolor(cobuff, coloratt, offset2[ii]);
2330 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
2331 ktrans = (char)(255U - ktrans) << 24;
2334 if (check_material) {
2345 if (pksh != ksh || pkem != kem || (kem && check_color)) {
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_point_is_masked(geosurf *, float *)
Check if point is masked.
void gsd_endtfan(void)
ADD.
void gsd_endtmesh(void)
ADD.
void gsd_pushmatrix(void)
Push the current matrix stack.
void GS_set_draw(int)
Sets which buffer to draw to.
void gsd_getwindow(int *, int *, double *, double *)
Get viewport.
int gs_getall_surfaces(geosurf **)
Get array of geosurf structs.
void gsd_do_scale(int)
Set current scale.
void GS_v3sub(float *, float *)
Subtract vectors.
void GS_v3mag(float *, float *)
Magnitude of vector.
int gs_get_att_src(geosurf *, int)
Get attribute source.
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
int gs_calc_normals(geosurf *)
Calculate normals.
int segs_intersect(float, float, float, float, float, float, float, float, float *, float *)
Line intersect.
int gsd_checkpoint(float[4], int[4], int[4], double[16], double[16])
ADD.
void GS_v3eq(float *, float *)
Copy vector values.
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
int gs_update_curmask(geosurf *)
Update current maps.
void show_colormode(void)
Print color mode to stderr.
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
void gsd_popmatrix(void)
Pop the current matrix stack.
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
void gsd_zwritemask(unsigned long)
Write out z-mask.
Point3 * gsdrape_get_allsegments(geosurf *, float *, float *, int *)
Get all segments.
void gsd_colormode(int)
Set color mode.
geosurf * gsdiff_get_SDref(void)
ADD.
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
void gsd_bgntfan(void)
ADD.
void gsd_set_material(int, int, float, float, int)
Set material.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
void gsd_3darrow(float *, unsigned long, float, float, float *, float)
Draw 3d north arrow.
float gsdiff_do_SD(float, int)
ADD.
void gsd_blend(int)
Specify pixel arithmetic.
void gsd_bgntmesh(void)
ADD.
int GS_check_cancel(void)
Check for cancel.
int gsd_arrow(float *, unsigned long, float, float *, float, geosurf *)
ADD.
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
float GS_global_exag(void)
Get global z-exag value.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int gsd_triangulated_wall(int npts1, int npts2, geosurf *surf1, geosurf *surf2, Point3 *points1, Point3 *points2, float *norm)
ADD.
int gsd_ortho_wall(int np, int ns, geosurf **gsurfs, Point3 **points, float *norm)
ADD.
void gsd_setfc(int mode)
ADD.
int gsd_surf_func(geosurf *gs UNUSED, int(*user_func)(void) UNUSED)
Define user function.
int gsd_norm_arrows(geosurf *surf)
ADD.
int gsd_surf_const(geosurf *surf, float k)
Using tmesh - not confident with qstrips portability.
int gsd_surf_map(geosurf *surf)
Draw surface using triangle fan instead of strip.
int gsd_wall(float *bgn, float *end, float *norm)
ADD.
int gsd_surf(geosurf *surf)
ADD.
#define SET_SCOLOR(sf)
MACROS for use in gsd_ortho_wall ONLY !!!
int gsd_surf_map_old(geosurf *surf)
ADD.
#define SCALE_ATT(att, val, low, high)
#define GET_MAPATT(buff, offset, att)
#define XY2OFF(gs, px, py)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)