… | |
… | |
191 | * goes someplace. |
191 | * goes someplace. |
192 | */ |
192 | */ |
193 | void |
193 | void |
194 | enter_player_savebed (object *op) |
194 | enter_player_savebed (object *op) |
195 | { |
195 | { |
196 | mapstruct *oldmap = op->map; |
196 | maptile *oldmap = op->map; |
197 | object *tmp; |
197 | object *tmp; |
198 | |
198 | |
199 | tmp = get_object (); |
199 | tmp = get_object (); |
200 | |
200 | |
201 | EXIT_PATH (tmp) = op->contr->savebed_map; |
201 | EXIT_PATH (tmp) = op->contr->savebed_map; |
… | |
… | |
226 | * the counts on the map if needed. |
226 | * the counts on the map if needed. |
227 | */ |
227 | */ |
228 | void |
228 | void |
229 | leave_map (object *op) |
229 | leave_map (object *op) |
230 | { |
230 | { |
231 | mapstruct *oldmap = op->map; |
231 | maptile *oldmap = op->map; |
232 | |
232 | |
233 | remove_ob (op); |
233 | remove_ob (op); |
234 | |
234 | |
235 | if (oldmap) |
235 | if (oldmap) |
236 | { |
236 | { |
… | |
… | |
249 | * player to - it could be the map he just came from if the load failed for |
249 | * player to - it could be the map he just came from if the load failed for |
250 | * whatever reason. If default map coordinates are to be used, then |
250 | * whatever reason. If default map coordinates are to be used, then |
251 | * the function that calls this should figure them out. |
251 | * the function that calls this should figure them out. |
252 | */ |
252 | */ |
253 | static void |
253 | static void |
254 | enter_map (object *op, mapstruct *newmap, int x, int y) |
254 | enter_map (object *op, maptile *newmap, int x, int y) |
255 | { |
255 | { |
256 | mapstruct *oldmap = op->map; |
256 | maptile *oldmap = op->map; |
257 | |
257 | |
258 | if (out_of_map (newmap, x, y)) |
258 | if (out_of_map (newmap, x, y)) |
259 | { |
259 | { |
260 | LOG (llevError, "enter_map: supplied coordinates are not within the map! (%s: %d, %d)\n", newmap->path, x, y); |
260 | LOG (llevError, "enter_map: supplied coordinates are not within the map! (%s: %d, %d)\n", newmap->path, x, y); |
261 | x = MAP_ENTER_X (newmap); |
261 | x = MAP_ENTER_X (newmap); |
… | |
… | |
381 | } |
381 | } |
382 | } |
382 | } |
383 | } |
383 | } |
384 | |
384 | |
385 | void |
385 | void |
386 | set_map_timeout (mapstruct *oldmap) |
386 | set_map_timeout (maptile *oldmap) |
387 | { |
387 | { |
388 | #if MAP_MAXTIMEOUT |
388 | #if MAP_MAXTIMEOUT |
389 | oldmap->timeout = MAP_TIMEOUT (oldmap); |
389 | oldmap->timeout = MAP_TIMEOUT (oldmap); |
390 | /* Do MINTIMEOUT first, so that MAXTIMEOUT is used if that is |
390 | /* Do MINTIMEOUT first, so that MAXTIMEOUT is used if that is |
391 | * lower than the min value. |
391 | * lower than the min value. |
… | |
… | |
452 | */ |
452 | */ |
453 | |
453 | |
454 | static void |
454 | static void |
455 | enter_random_map (object *pl, object *exit_ob) |
455 | enter_random_map (object *pl, object *exit_ob) |
456 | { |
456 | { |
457 | mapstruct *new_map; |
457 | maptile *new_map; |
458 | char newmap_name[HUGE_BUF], *cp; |
458 | char newmap_name[HUGE_BUF], *cp; |
459 | static int reference_number = 0; |
459 | static int reference_number = 0; |
460 | RMParms rp; |
460 | RMParms rp; |
461 | |
461 | |
462 | memset (&rp, 0, sizeof (RMParms)); |
462 | memset (&rp, 0, sizeof (RMParms)); |
… | |
… | |
522 | */ |
522 | */ |
523 | |
523 | |
524 | static void |
524 | static void |
525 | enter_fixed_template_map (object *pl, object *exit_ob) |
525 | enter_fixed_template_map (object *pl, object *exit_ob) |
526 | { |
526 | { |
527 | mapstruct *new_map; |
527 | maptile *new_map; |
528 | char tmpnum[32], exitpath[HUGE_BUF], resultname[HUGE_BUF], tmpstring[HUGE_BUF], *sourcemap; |
528 | char tmpnum[32], exitpath[HUGE_BUF], resultname[HUGE_BUF], tmpstring[HUGE_BUF], *sourcemap; |
529 | const char *new_map_name; |
529 | const char *new_map_name; |
530 | |
530 | |
531 | /* Split the exit path string into two parts, one |
531 | /* Split the exit path string into two parts, one |
532 | * for where to store the map, and one for were |
532 | * for where to store the map, and one for were |
… | |
… | |
614 | */ |
614 | */ |
615 | |
615 | |
616 | static void |
616 | static void |
617 | enter_random_template_map (object *pl, object *exit_ob) |
617 | enter_random_template_map (object *pl, object *exit_ob) |
618 | { |
618 | { |
619 | mapstruct *new_map; |
619 | maptile *new_map; |
620 | char tmpnum[32], resultname[HUGE_BUF], tmpstring[HUGE_BUF]; |
620 | char tmpnum[32], resultname[HUGE_BUF], tmpstring[HUGE_BUF]; |
621 | const char *new_map_name; |
621 | const char *new_map_name; |
622 | RMParms rp; |
622 | RMParms rp; |
623 | |
623 | |
624 | /* Do replacement of %x, %y, and %n to the x coord of the exit, the y coord |
624 | /* Do replacement of %x, %y, and %n to the x coord of the exit, the y coord |
… | |
… | |
686 | */ |
686 | */ |
687 | static void |
687 | static void |
688 | enter_unique_map (object *op, object *exit_ob) |
688 | enter_unique_map (object *op, object *exit_ob) |
689 | { |
689 | { |
690 | char apartment[HUGE_BUF]; |
690 | char apartment[HUGE_BUF]; |
691 | mapstruct *newmap; |
691 | maptile *newmap; |
692 | |
692 | |
693 | if (EXIT_PATH (exit_ob)[0] == '/') |
693 | if (EXIT_PATH (exit_ob)[0] == '/') |
694 | { |
694 | { |
695 | sprintf (apartment, "%s/%s/%s/%s", settings.localdir, settings.playerdir, &op->name, clean_path (EXIT_PATH (exit_ob))); |
695 | sprintf (apartment, "%s/%s/%s/%s", settings.localdir, settings.playerdir, &op->name, clean_path (EXIT_PATH (exit_ob))); |
696 | newmap = ready_map_name (apartment, MAP_PLAYER_UNIQUE); |
696 | newmap = ready_map_name (apartment, MAP_PLAYER_UNIQUE); |
… | |
… | |
819 | int x = EXIT_X (exit_ob), y = EXIT_Y (exit_ob); |
819 | int x = EXIT_X (exit_ob), y = EXIT_Y (exit_ob); |
820 | |
820 | |
821 | /* 'Normal' exits that do not do anything special |
821 | /* 'Normal' exits that do not do anything special |
822 | * Simple enough we don't need another routine for it. |
822 | * Simple enough we don't need another routine for it. |
823 | */ |
823 | */ |
824 | mapstruct *newmap; |
824 | maptile *newmap; |
825 | |
825 | |
826 | if (exit_ob->map) |
826 | if (exit_ob->map) |
827 | { |
827 | { |
828 | newmap = ready_map_name (path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob)), 0); |
828 | newmap = ready_map_name (path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob)), 0); |
829 | /* Random map was previously generated, but is no longer about. Lets generate a new |
829 | /* Random map was previously generated, but is no longer about. Lets generate a new |
… | |
… | |
918 | hit_player (op, exit_ob->stats.dam, exit_ob, exit_ob->attacktype, 1); |
918 | hit_player (op, exit_ob->stats.dam, exit_ob, exit_ob->attacktype, 1); |
919 | } |
919 | } |
920 | else |
920 | else |
921 | { |
921 | { |
922 | int flags = 0; |
922 | int flags = 0; |
923 | mapstruct *newmap; |
923 | maptile *newmap; |
924 | |
924 | |
925 | |
925 | |
926 | /* Hypothetically, I guess its possible that a standard map matches |
926 | /* Hypothetically, I guess its possible that a standard map matches |
927 | * the localdir, but that seems pretty unlikely - unlikely enough that |
927 | * the localdir, but that seems pretty unlikely - unlikely enough that |
928 | * I'm not going to attempt to try to deal with that possibility. |
928 | * I'm not going to attempt to try to deal with that possibility. |
… | |
… | |
964 | |
964 | |
965 | #if 0 // dead code, schmorp |
965 | #if 0 // dead code, schmorp |
966 | void |
966 | void |
967 | process_active_maps () |
967 | process_active_maps () |
968 | { |
968 | { |
969 | for (mapstruct *map = first_map; map != NULL; map = map->next) |
969 | for (maptile *map = first_map; map != NULL; map = map->next) |
970 | if (map->in_memory == MAP_IN_MEMORY) |
970 | if (map->in_memory == MAP_IN_MEMORY) |
971 | if (players_on_map (map, TRUE)) |
971 | if (players_on_map (map, TRUE)) |
972 | process_events (map); |
972 | process_events (map); |
973 | } |
973 | } |
974 | #endif |
974 | #endif |
… | |
… | |
980 | * objects have been updated, process_players2() does the processing that |
980 | * objects have been updated, process_players2() does the processing that |
981 | * is needed after the players have been updated. |
981 | * is needed after the players have been updated. |
982 | */ |
982 | */ |
983 | |
983 | |
984 | void |
984 | void |
985 | process_players1 (mapstruct *map) |
985 | process_players1 (maptile *map) |
986 | { |
986 | { |
987 | int flag; |
987 | int flag; |
988 | player *pl, *plnext; |
988 | player *pl, *plnext; |
989 | |
989 | |
990 | /* Basically, we keep looping until all the players have done their actions. */ |
990 | /* Basically, we keep looping until all the players have done their actions. */ |
… | |
… | |
1057 | /* draw(pl->ob); *//* updated in socket code */ |
1057 | /* draw(pl->ob); *//* updated in socket code */ |
1058 | } |
1058 | } |
1059 | } |
1059 | } |
1060 | |
1060 | |
1061 | void |
1061 | void |
1062 | process_players2 (mapstruct *map) |
1062 | process_players2 (maptile *map) |
1063 | { |
1063 | { |
1064 | player *pl; |
1064 | player *pl; |
1065 | |
1065 | |
1066 | /* Then check if any players should use weapon-speed instead of speed */ |
1066 | /* Then check if any players should use weapon-speed instead of speed */ |
1067 | for (pl = first_player; pl != NULL; pl = pl->next) |
1067 | for (pl = first_player; pl != NULL; pl = pl->next) |
… | |
… | |
1097 | pl->ob->speed_left = pl->ob->speed; |
1097 | pl->ob->speed_left = pl->ob->speed; |
1098 | } |
1098 | } |
1099 | } |
1099 | } |
1100 | |
1100 | |
1101 | void |
1101 | void |
1102 | process_events (mapstruct *map) |
1102 | process_events (maptile *map) |
1103 | { |
1103 | { |
1104 | object *op; |
1104 | object *op; |
1105 | |
1105 | |
1106 | static object *marker; |
1106 | static object *marker; |
1107 | if (!marker) |
1107 | if (!marker) |
… | |
… | |
1238 | } |
1238 | } |
1239 | |
1239 | |
1240 | void |
1240 | void |
1241 | clean_tmp_files (void) |
1241 | clean_tmp_files (void) |
1242 | { |
1242 | { |
1243 | mapstruct *m, *next; |
1243 | maptile *m, *next; |
1244 | |
1244 | |
1245 | LOG (llevInfo, "Cleaning up...\n"); |
1245 | LOG (llevInfo, "Cleaning up...\n"); |
1246 | |
1246 | |
1247 | /* We save the maps - it may not be intuitive why, but if there are unique |
1247 | /* We save the maps - it may not be intuitive why, but if there are unique |
1248 | * items, we need to save the map so they get saved off. Perhaps we should |
1248 | * items, we need to save the map so they get saved off. Perhaps we should |