1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.11 2006/08/28 16:12:59 root Exp $"; |
3 | * "$Id: map.C,v 1.13 2006/08/29 09:35:51 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
895 | * for compatibility reasons. The new values (second) are |
895 | * for compatibility reasons. The new values (second) are |
896 | * what really should be used. |
896 | * what really should be used. |
897 | */ |
897 | */ |
898 | else if (!strcmp(key,"oid")) { |
898 | else if (!strcmp(key,"oid")) { |
899 | fp.get (m, atoi(value)); |
899 | fp.get (m, atoi(value)); |
|
|
900 | } else if (!strcmp(key, "attach")) { |
|
|
901 | m->attach = add_string (value); |
900 | } else if (!strcmp(key,"hp") || !strcmp(key, "enter_x")) { |
902 | } else if (!strcmp(key,"hp") || !strcmp(key, "enter_x")) { |
901 | m->enter_x = atoi(value); |
903 | m->enter_x = atoi(value); |
902 | } else if (!strcmp(key,"sp") || !strcmp(key, "enter_y")) { |
904 | } else if (!strcmp(key,"sp") || !strcmp(key, "enter_y")) { |
903 | m->enter_y = atoi(value); |
905 | m->enter_y = atoi(value); |
904 | } else if (!strcmp(key,"x") || !strcmp(key, "width")) { |
906 | } else if (!strcmp(key,"x") || !strcmp(key, "width")) { |
… | |
… | |
947 | m->winddir = atoi(value); |
949 | m->winddir = atoi(value); |
948 | } else if (!strcmp(key, "sky")) { |
950 | } else if (!strcmp(key, "sky")) { |
949 | m->sky = atoi(value); |
951 | m->sky = atoi(value); |
950 | } else if (!strcmp(key, "nosmooth")) { |
952 | } else if (!strcmp(key, "nosmooth")) { |
951 | m->nosmooth = atoi(value); |
953 | m->nosmooth = atoi(value); |
952 | } else if (!strcmp(key, "safe_map")) { |
|
|
953 | m->safe_map = atoi(value); |
|
|
954 | } |
954 | } |
955 | else if (!strncmp(key,"tile_path_", 10)) { |
955 | else if (!strncmp(key,"tile_path_", 10)) { |
956 | int tile=atoi(key+10); |
956 | int tile=atoi(key+10); |
957 | |
957 | |
958 | if (tile<1 || tile>4) { |
958 | if (tile<1 || tile>4) { |
… | |
… | |
1054 | close_and_delete(fp, comp); |
1054 | close_and_delete(fp, comp); |
1055 | m->in_memory=MAP_IN_MEMORY; |
1055 | m->in_memory=MAP_IN_MEMORY; |
1056 | if (!MAP_DIFFICULTY(m)) |
1056 | if (!MAP_DIFFICULTY(m)) |
1057 | MAP_DIFFICULTY(m)=calculate_difficulty(m); |
1057 | MAP_DIFFICULTY(m)=calculate_difficulty(m); |
1058 | set_map_reset_time(m); |
1058 | set_map_reset_time(m); |
1059 | INVOKE_MAP (INSTANTIATE, m); |
1059 | m->instantiate (); |
1060 | return (m); |
1060 | return (m); |
1061 | } |
1061 | } |
1062 | |
1062 | |
1063 | /* |
1063 | /* |
1064 | * Loads a map, which has been loaded earlier, from file. |
1064 | * Loads a map, which has been loaded earlier, from file. |
… | |
… | |
1327 | fprintf (fp, "winddir %d\n", m->winddir); |
1327 | fprintf (fp, "winddir %d\n", m->winddir); |
1328 | if (m->sky) |
1328 | if (m->sky) |
1329 | fprintf (fp, "sky %d\n", m->sky); |
1329 | fprintf (fp, "sky %d\n", m->sky); |
1330 | if (m->nosmooth) |
1330 | if (m->nosmooth) |
1331 | fprintf (fp, "nosmooth %d\n", m->nosmooth); |
1331 | fprintf (fp, "nosmooth %d\n", m->nosmooth); |
1332 | if (m->safe_map) |
|
|
1333 | fprintf (fp, "safe_map %d\n", m->safe_map); |
|
|
1334 | |
1332 | |
1335 | /* Save any tiling information, except on overlays */ |
1333 | /* Save any tiling information, except on overlays */ |
1336 | if (flag != 2) |
1334 | if (flag != 2) |
1337 | for (i = 0; i < 4; i++) |
1335 | for (i = 0; i < 4; i++) |
1338 | if (m->tile_path[i]) |
1336 | if (m->tile_path[i]) |
1339 | fprintf (fp, "tile_path_%d %s\n", i + 1, m->tile_path[i]); |
1337 | fprintf (fp, "tile_path_%d %s\n", i + 1, m->tile_path[i]); |
1340 | |
1338 | |
|
|
1339 | fp.put (m); |
1341 | fprintf (fp, "end\n"); |
1340 | fprintf (fp, "end\n"); |
1342 | |
1341 | |
1343 | /* In the game save unique items in the different file, but |
1342 | /* In the game save unique items in the different file, but |
1344 | * in the editor save them to the normal map file. |
1343 | * in the editor save them to the normal map file. |
1345 | * If unique map, save files in the proper destination (set by |
1344 | * If unique map, save files in the proper destination (set by |