… | |
… | |
27 | |
27 | |
28 | #include <loader.h> |
28 | #include <loader.h> |
29 | #include <unistd.h> |
29 | #include <unistd.h> |
30 | |
30 | |
31 | #include "path.h" |
31 | #include "path.h" |
32 | |
|
|
33 | |
32 | |
34 | /* |
33 | /* |
35 | * Returns the maptile which has a name matching the given argument. |
34 | * Returns the maptile which has a name matching the given argument. |
36 | * return NULL if no match is found. |
35 | * return NULL if no match is found. |
37 | */ |
36 | */ |
… | |
… | |
324 | /* We basically go through the stack of objects, and if there is |
323 | /* We basically go through the stack of objects, and if there is |
325 | * some other object that has NO_PASS or FLAG_ALIVE set, return |
324 | * some other object that has NO_PASS or FLAG_ALIVE set, return |
326 | * true. If we get through the entire stack, that must mean |
325 | * true. If we get through the entire stack, that must mean |
327 | * ob is blocking it, so return 0. |
326 | * ob is blocking it, so return 0. |
328 | */ |
327 | */ |
329 | for (tmp = GET_MAP_OB (m, sx, sy); tmp != NULL; tmp = tmp->above) |
328 | for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above) |
330 | { |
329 | { |
331 | |
330 | |
332 | /* This must be before the checks below. Code for inventory checkers. */ |
331 | /* This must be before the checks below. Code for inventory checkers. */ |
333 | if (tmp->type == CHECK_INV && OB_MOVE_BLOCK (ob, tmp)) |
332 | if (tmp->type == CHECK_INV && OB_MOVE_BLOCK (ob, tmp)) |
334 | { |
333 | { |
… | |
… | |
398 | * |
397 | * |
399 | * Note this used to be arch_blocked, but with new movement |
398 | * Note this used to be arch_blocked, but with new movement |
400 | * code, we need to have actual object to check its move_type |
399 | * code, we need to have actual object to check its move_type |
401 | * against the move_block values. |
400 | * against the move_block values. |
402 | */ |
401 | */ |
403 | |
|
|
404 | int |
402 | int |
405 | ob_blocked (const object *ob, maptile *m, sint16 x, sint16 y) |
403 | ob_blocked (const object *ob, maptile *m, sint16 x, sint16 y) |
406 | { |
404 | { |
407 | archetype *tmp; |
405 | archetype *tmp; |
408 | int flag; |
406 | int flag; |
… | |
… | |
438 | |
436 | |
439 | /* Note it is intentional that we check ob - the movement type of the |
437 | /* Note it is intentional that we check ob - the movement type of the |
440 | * head of the object should correspond for the entire object. |
438 | * head of the object should correspond for the entire object. |
441 | */ |
439 | */ |
442 | if (OB_TYPE_MOVE_BLOCK (ob, GET_MAP_MOVE_BLOCK (m1, sx, sy))) |
440 | if (OB_TYPE_MOVE_BLOCK (ob, GET_MAP_MOVE_BLOCK (m1, sx, sy))) |
443 | return AB_NO_PASS; |
441 | return P_NO_PASS; |
444 | |
|
|
445 | } |
442 | } |
|
|
443 | |
446 | return 0; |
444 | return 0; |
447 | } |
445 | } |
448 | |
446 | |
449 | /* When the map is loaded, load_object does not actually insert objects |
447 | /* When the map is loaded, load_object does not actually insert objects |
450 | * into inventory, but just links them. What this does is go through |
448 | * into inventory, but just links them. What this does is go through |
… | |
… | |
487 | object *tmp, *op, *last, *above; |
485 | object *tmp, *op, *last, *above; |
488 | archetype *at; |
486 | archetype *at; |
489 | |
487 | |
490 | for (x = 0; x < MAP_WIDTH (m); x++) |
488 | for (x = 0; x < MAP_WIDTH (m); x++) |
491 | for (y = 0; y < MAP_HEIGHT (m); y++) |
489 | for (y = 0; y < MAP_HEIGHT (m); y++) |
492 | for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = above) |
490 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = above) |
493 | { |
491 | { |
494 | above = tmp->above; |
492 | above = tmp->above; |
495 | |
493 | |
496 | /* already multipart - don't do anything more */ |
494 | /* already multipart - don't do anything more */ |
497 | if (tmp->head || tmp->more) |
495 | if (tmp->head || tmp->more) |
… | |
… | |
532 | { |
530 | { |
533 | int i, j; |
531 | int i, j; |
534 | int unique; |
532 | int unique; |
535 | object *op, *prev = NULL, *last_more = NULL, *otmp; |
533 | object *op, *prev = NULL, *last_more = NULL, *otmp; |
536 | |
534 | |
537 | op = get_object (); |
535 | op = object::create (); |
538 | op->map = m; /* To handle buttons correctly */ |
536 | op->map = m; /* To handle buttons correctly */ |
539 | |
537 | |
540 | while ((i = load_object (fp, op, mapflags))) |
538 | while ((i = load_object (fp, op, mapflags))) |
541 | { |
539 | { |
542 | /* if the archetype for the object is null, means that we |
540 | /* if the archetype for the object is null, means that we |
… | |
… | |
550 | } |
548 | } |
551 | |
549 | |
552 | |
550 | |
553 | switch (i) |
551 | switch (i) |
554 | { |
552 | { |
555 | case LL_NORMAL: |
553 | case LL_NORMAL: |
556 | /* if we are loading an overlay, put the floors on the bottom */ |
554 | /* if we are loading an overlay, put the floors on the bottom */ |
557 | if ((QUERY_FLAG (op, FLAG_IS_FLOOR) || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR)) && mapflags & MAP_OVERLAY) |
555 | if ((QUERY_FLAG (op, FLAG_IS_FLOOR) || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR)) && mapflags & MAP_OVERLAY) |
558 | insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY | INS_MAP_LOAD); |
556 | insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY | INS_MAP_LOAD); |
559 | else |
557 | else |
560 | insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD); |
558 | insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD); |
561 | |
559 | |
562 | if (op->inv) |
560 | if (op->inv) |
563 | sum_weight (op); |
561 | sum_weight (op); |
564 | |
562 | |
565 | prev = op, last_more = op; |
563 | prev = op, last_more = op; |
566 | break; |
564 | break; |
567 | |
565 | |
568 | case LL_MORE: |
566 | case LL_MORE: |
569 | insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY); |
567 | insert_ob_in_map (op, m, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY); |
570 | op->head = prev, last_more->more = op, last_more = op; |
568 | op->head = prev, last_more->more = op, last_more = op; |
571 | break; |
569 | break; |
572 | } |
570 | } |
573 | |
571 | |
574 | if (mapflags & MAP_STYLE) |
572 | if (mapflags & MAP_STYLE) |
575 | remove_from_active_list (op); |
573 | remove_from_active_list (op); |
576 | |
574 | |
577 | op = get_object (); |
575 | op = object::create (); |
578 | op->map = m; |
576 | op->map = m; |
579 | } |
577 | } |
580 | |
578 | |
581 | for (i = 0; i < m->width; i++) |
579 | for (i = 0; i < m->width; i++) |
582 | { |
580 | { |
583 | for (j = 0; j < m->height; j++) |
581 | for (j = 0; j < m->height; j++) |
584 | { |
582 | { |
585 | unique = 0; |
583 | unique = 0; |
586 | /* check for unique items, or unique squares */ |
584 | /* check for unique items, or unique squares */ |
587 | for (otmp = get_map_ob (m, i, j); otmp; otmp = otmp->above) |
585 | for (otmp = GET_MAP_OB (m, i, j); otmp; otmp = otmp->above) |
588 | { |
586 | { |
589 | if (QUERY_FLAG (otmp, FLAG_UNIQUE) || QUERY_FLAG (otmp, FLAG_OBJ_SAVE_ON_OVL)) |
587 | if (QUERY_FLAG (otmp, FLAG_UNIQUE) || QUERY_FLAG (otmp, FLAG_OBJ_SAVE_ON_OVL)) |
590 | unique = 1; |
588 | unique = 1; |
|
|
589 | |
591 | if (!(mapflags & (MAP_OVERLAY | MAP_PLAYER_UNIQUE) || unique)) |
590 | if (!(mapflags & (MAP_OVERLAY | MAP_PLAYER_UNIQUE) || unique)) |
592 | SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); |
591 | SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); |
593 | } |
592 | } |
594 | } |
593 | } |
595 | } |
594 | } |
596 | |
595 | |
597 | op->destroy (0); |
596 | op->destroy (); |
598 | link_multipart_objects (m); |
597 | link_multipart_objects (m); |
599 | } |
598 | } |
600 | |
599 | |
601 | /* This saves all the objects on the map in a non destructive fashion. |
600 | /* This saves all the objects on the map in a non destructive fashion. |
602 | * Modified by MSW 2001-07-01 to do in a single pass - reduces code, |
601 | * Modified by MSW 2001-07-01 to do in a single pass - reduces code, |
… | |
… | |
612 | /* first pass - save one-part objects */ |
611 | /* first pass - save one-part objects */ |
613 | for (i = 0; i < MAP_WIDTH (m); i++) |
612 | for (i = 0; i < MAP_WIDTH (m); i++) |
614 | for (j = 0; j < MAP_HEIGHT (m); j++) |
613 | for (j = 0; j < MAP_HEIGHT (m); j++) |
615 | { |
614 | { |
616 | unique = 0; |
615 | unique = 0; |
617 | for (op = get_map_ob (m, i, j); op; op = op->above) |
616 | for (op = GET_MAP_OB (m, i, j); op; op = op->above) |
618 | { |
617 | { |
619 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
618 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
620 | unique = 1; |
619 | unique = 1; |
621 | |
620 | |
622 | if (op->type == PLAYER) |
621 | if (op->type == PLAYER) |
623 | { |
|
|
624 | LOG (llevDebug, "Player on map that is being saved\n"); |
|
|
625 | continue; |
622 | continue; |
626 | } |
|
|
627 | |
623 | |
628 | if (op->head || op->owner) |
624 | if (op->head || op->owner) |
629 | continue; |
625 | continue; |
630 | |
626 | |
631 | if (unique || QUERY_FLAG (op, FLAG_UNIQUE)) |
627 | if (unique || QUERY_FLAG (op, FLAG_UNIQUE)) |
632 | save_object (fp2, op, 3); |
628 | save_object (fp2, op, 3); |
633 | else if (flag == 0 || (flag == 2 && (!QUERY_FLAG (op, FLAG_OBJ_ORIGINAL) && !QUERY_FLAG (op, FLAG_UNPAID)))) |
629 | else if (flag == 0 || (flag == 2 && (!QUERY_FLAG (op, FLAG_OBJ_ORIGINAL) && !QUERY_FLAG (op, FLAG_UNPAID)))) |
634 | save_object (fp, op, 3); |
630 | save_object (fp, op, 3); |
635 | |
631 | } |
636 | } /* for this space */ |
632 | } |
637 | } /* for this j */ |
|
|
638 | } |
633 | } |
639 | |
634 | |
640 | maptile::maptile () |
635 | maptile::maptile () |
641 | { |
636 | { |
642 | in_memory = MAP_SWAPPED; |
637 | in_memory = MAP_SWAPPED; |
… | |
… | |
692 | { |
687 | { |
693 | LOG (llevError, "allocate_map called with already allocated map (%s)\n", path); |
688 | LOG (llevError, "allocate_map called with already allocated map (%s)\n", path); |
694 | free (spaces); |
689 | free (spaces); |
695 | } |
690 | } |
696 | |
691 | |
697 | spaces = (MapSpace *) |
692 | spaces = (mapspace *) |
698 | calloc (1, width * height * sizeof (MapSpace)); |
693 | calloc (1, width * height * sizeof (mapspace)); |
699 | |
694 | |
700 | if (!spaces) |
695 | if (!spaces) |
701 | fatal (OUT_OF_MEMORY); |
696 | fatal (OUT_OF_MEMORY); |
702 | } |
697 | } |
703 | |
698 | |
… | |
… | |
729 | char *shop_string, *p, *q, *next_semicolon, *next_colon; |
724 | char *shop_string, *p, *q, *next_semicolon, *next_colon; |
730 | shopitems *items = NULL; |
725 | shopitems *items = NULL; |
731 | int i = 0, number_of_entries = 0; |
726 | int i = 0, number_of_entries = 0; |
732 | const typedata *current_type; |
727 | const typedata *current_type; |
733 | |
728 | |
734 | shop_string = strdup_local (input_string); |
729 | shop_string = strdup (input_string); |
735 | p = shop_string; |
730 | p = shop_string; |
736 | /* first we'll count the entries, we'll need that for allocating the array shortly */ |
731 | /* first we'll count the entries, we'll need that for allocating the array shortly */ |
737 | while (p) |
732 | while (p) |
738 | { |
733 | { |
739 | p = strchr (p, ';'); |
734 | p = strchr (p, ';'); |
… | |
… | |
925 | * with nothing between). There is no reason in those cases to |
920 | * with nothing between). There is no reason in those cases to |
926 | * keep the empty message. Also, msgbuf contains garbage data |
921 | * keep the empty message. Also, msgbuf contains garbage data |
927 | * when msgpos is zero, so copying it results in crashes |
922 | * when msgpos is zero, so copying it results in crashes |
928 | */ |
923 | */ |
929 | if (msgpos != 0) |
924 | if (msgpos != 0) |
930 | m->msg = strdup_local (msgbuf); |
925 | m->msg = strdup (msgbuf); |
931 | } |
926 | } |
932 | else if (!strcmp (key, "maplore")) |
927 | else if (!strcmp (key, "maplore")) |
933 | { |
928 | { |
934 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
929 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
935 | { |
930 | { |
… | |
… | |
941 | strcpy (maplorebuf + maplorepos, buf); |
936 | strcpy (maplorebuf + maplorepos, buf); |
942 | maplorepos += strlen (buf); |
937 | maplorepos += strlen (buf); |
943 | } |
938 | } |
944 | } |
939 | } |
945 | if (maplorepos != 0) |
940 | if (maplorepos != 0) |
946 | m->maplore = strdup_local (maplorebuf); |
941 | m->maplore = strdup (maplorebuf); |
947 | } |
942 | } |
948 | else if (!strcmp (key, "end")) |
943 | else if (!strcmp (key, "end")) |
949 | { |
944 | { |
950 | break; |
945 | break; |
951 | } |
946 | } |
… | |
… | |
960 | LOG (llevError, "loading map and got a non 'arch map' line(%s %s)?\n", key, value); |
955 | LOG (llevError, "loading map and got a non 'arch map' line(%s %s)?\n", key, value); |
961 | } |
956 | } |
962 | else if (!strcmp (key, "name")) |
957 | else if (!strcmp (key, "name")) |
963 | { |
958 | { |
964 | *end = 0; |
959 | *end = 0; |
965 | m->name = strdup_local (value); |
960 | m->name = strdup (value); |
966 | } |
961 | } |
967 | /* first strcmp value on these are old names supported |
962 | /* first strcmp value on these are old names supported |
968 | * for compatibility reasons. The new values (second) are |
963 | * for compatibility reasons. The new values (second) are |
969 | * what really should be used. |
964 | * what really should be used. |
970 | */ |
965 | */ |
971 | else if (!strcmp (key, "oid")) |
966 | else if (!strcmp (key, "oid")) |
972 | { |
|
|
973 | fp.get (m, atoi (value)); |
967 | fp.get (m, atoi (value)); |
974 | } |
|
|
975 | else if (!strcmp (key, "attach")) |
968 | else if (!strcmp (key, "attach")) |
976 | { |
|
|
977 | m->attach = value; |
969 | m->attach = value; |
978 | } |
|
|
979 | else if (!strcmp (key, "hp") || !strcmp (key, "enter_x")) |
970 | else if (!strcmp (key, "hp") || !strcmp (key, "enter_x")) |
980 | { |
|
|
981 | m->enter_x = atoi (value); |
971 | m->enter_x = atoi (value); |
982 | } |
|
|
983 | else if (!strcmp (key, "sp") || !strcmp (key, "enter_y")) |
972 | else if (!strcmp (key, "sp") || !strcmp (key, "enter_y")) |
984 | { |
|
|
985 | m->enter_y = atoi (value); |
973 | m->enter_y = atoi (value); |
986 | } |
|
|
987 | else if (!strcmp (key, "x") || !strcmp (key, "width")) |
974 | else if (!strcmp (key, "x") || !strcmp (key, "width")) |
988 | { |
|
|
989 | m->width = atoi (value); |
975 | m->width = atoi (value); |
990 | } |
|
|
991 | else if (!strcmp (key, "y") || !strcmp (key, "height")) |
976 | else if (!strcmp (key, "y") || !strcmp (key, "height")) |
992 | { |
|
|
993 | m->height = atoi (value); |
977 | m->height = atoi (value); |
994 | } |
|
|
995 | else if (!strcmp (key, "weight") || !strcmp (key, "reset_timeout")) |
978 | else if (!strcmp (key, "weight") || !strcmp (key, "reset_timeout")) |
996 | { |
|
|
997 | m->reset_timeout = atoi (value); |
979 | m->reset_timeout = atoi (value); |
998 | } |
|
|
999 | else if (!strcmp (key, "value") || !strcmp (key, "swap_time")) |
980 | else if (!strcmp (key, "value") || !strcmp (key, "swap_time")) |
1000 | { |
|
|
1001 | m->timeout = atoi (value); |
981 | m->timeout = atoi (value); |
1002 | } |
|
|
1003 | else if (!strcmp (key, "level") || !strcmp (key, "difficulty")) |
982 | else if (!strcmp (key, "level") || !strcmp (key, "difficulty")) |
1004 | { |
983 | m->difficulty = clamp (atoi (value), 1, settings.max_level); |
1005 | m->difficulty = atoi (value); |
|
|
1006 | } |
|
|
1007 | else if (!strcmp (key, "invisible") || !strcmp (key, "darkness")) |
984 | else if (!strcmp (key, "invisible") || !strcmp (key, "darkness")) |
1008 | { |
|
|
1009 | m->darkness = atoi (value); |
985 | m->darkness = atoi (value); |
1010 | } |
|
|
1011 | else if (!strcmp (key, "stand_still") || !strcmp (key, "fixed_resettime")) |
986 | else if (!strcmp (key, "stand_still") || !strcmp (key, "fixed_resettime")) |
1012 | { |
|
|
1013 | m->fixed_resettime = atoi (value); |
987 | m->fixed_resettime = atoi (value); |
1014 | } |
|
|
1015 | else if (!strcmp (key, "unique")) |
988 | else if (!strcmp (key, "unique")) |
1016 | { |
|
|
1017 | m->unique = atoi (value); |
989 | m->unique = atoi (value); |
1018 | } |
|
|
1019 | else if (!strcmp (key, "template")) |
990 | else if (!strcmp (key, "template")) |
1020 | { |
|
|
1021 | m->templatemap = atoi (value); |
991 | m->templatemap = atoi (value); |
1022 | } |
|
|
1023 | else if (!strcmp (key, "region")) |
992 | else if (!strcmp (key, "region")) |
1024 | { |
|
|
1025 | m->region = get_region_by_name (value); |
993 | m->region = get_region_by_name (value); |
1026 | } |
|
|
1027 | else if (!strcmp (key, "shopitems")) |
994 | else if (!strcmp (key, "shopitems")) |
1028 | { |
995 | { |
1029 | *end = 0; |
996 | *end = 0; |
1030 | m->shopitems = parse_shop_string (value); |
997 | m->shopitems = parse_shop_string (value); |
1031 | } |
998 | } |
1032 | else if (!strcmp (key, "shopgreed")) |
999 | else if (!strcmp (key, "shopgreed")) |
1033 | { |
|
|
1034 | m->shopgreed = atof (value); |
1000 | m->shopgreed = atof (value); |
1035 | } |
|
|
1036 | else if (!strcmp (key, "shopmin")) |
1001 | else if (!strcmp (key, "shopmin")) |
1037 | { |
|
|
1038 | m->shopmin = atol (value); |
1002 | m->shopmin = atol (value); |
1039 | } |
|
|
1040 | else if (!strcmp (key, "shopmax")) |
1003 | else if (!strcmp (key, "shopmax")) |
1041 | { |
|
|
1042 | m->shopmax = atol (value); |
1004 | m->shopmax = atol (value); |
1043 | } |
|
|
1044 | else if (!strcmp (key, "shoprace")) |
1005 | else if (!strcmp (key, "shoprace")) |
1045 | { |
1006 | { |
1046 | *end = 0; |
1007 | *end = 0; |
1047 | m->shoprace = strdup_local (value); |
1008 | m->shoprace = strdup (value); |
1048 | } |
1009 | } |
1049 | else if (!strcmp (key, "outdoor")) |
1010 | else if (!strcmp (key, "outdoor")) |
1050 | { |
|
|
1051 | m->outdoor = atoi (value); |
1011 | m->outdoor = atoi (value); |
1052 | } |
|
|
1053 | else if (!strcmp (key, "temp")) |
1012 | else if (!strcmp (key, "temp")) |
1054 | { |
|
|
1055 | m->temp = atoi (value); |
1013 | m->temp = atoi (value); |
1056 | } |
|
|
1057 | else if (!strcmp (key, "pressure")) |
1014 | else if (!strcmp (key, "pressure")) |
1058 | { |
|
|
1059 | m->pressure = atoi (value); |
1015 | m->pressure = atoi (value); |
1060 | } |
|
|
1061 | else if (!strcmp (key, "humid")) |
1016 | else if (!strcmp (key, "humid")) |
1062 | { |
|
|
1063 | m->humid = atoi (value); |
1017 | m->humid = atoi (value); |
1064 | } |
|
|
1065 | else if (!strcmp (key, "windspeed")) |
1018 | else if (!strcmp (key, "windspeed")) |
1066 | { |
|
|
1067 | m->windspeed = atoi (value); |
1019 | m->windspeed = atoi (value); |
1068 | } |
|
|
1069 | else if (!strcmp (key, "winddir")) |
1020 | else if (!strcmp (key, "winddir")) |
1070 | { |
|
|
1071 | m->winddir = atoi (value); |
1021 | m->winddir = atoi (value); |
1072 | } |
|
|
1073 | else if (!strcmp (key, "sky")) |
1022 | else if (!strcmp (key, "sky")) |
1074 | { |
|
|
1075 | m->sky = atoi (value); |
1023 | m->sky = atoi (value); |
1076 | } |
|
|
1077 | else if (!strcmp (key, "nosmooth")) |
1024 | else if (!strcmp (key, "nosmooth")) |
1078 | { |
|
|
1079 | m->nosmooth = atoi (value); |
1025 | m->nosmooth = atoi (value); |
1080 | } |
|
|
1081 | else if (!strncmp (key, "tile_path_", 10)) |
1026 | else if (!strncmp (key, "tile_path_", 10)) |
1082 | { |
1027 | { |
1083 | int tile = atoi (key + 10); |
1028 | int tile = atoi (key + 10); |
1084 | |
1029 | |
1085 | if (tile < 1 || tile > 4) |
1030 | if (tile < 1 || tile > 4) |
… | |
… | |
1118 | } |
1063 | } |
1119 | |
1064 | |
1120 | if (editor) |
1065 | if (editor) |
1121 | { |
1066 | { |
1122 | /* Use the value as in the file. */ |
1067 | /* Use the value as in the file. */ |
1123 | m->tile_path[tile - 1] = strdup_local (value); |
1068 | m->tile_path[tile - 1] = strdup (value); |
1124 | } |
1069 | } |
1125 | else if (path != NULL) |
1070 | else if (path != NULL) |
1126 | { |
1071 | { |
1127 | /* Use the normalized value. */ |
1072 | /* Use the normalized value. */ |
1128 | m->tile_path[tile - 1] = strdup_local (path); |
1073 | m->tile_path[tile - 1] = strdup (path); |
1129 | } |
1074 | } |
1130 | } /* end if tile direction (in)valid */ |
1075 | } /* end if tile direction (in)valid */ |
1131 | } |
1076 | } |
1132 | else |
1077 | else |
1133 | { |
|
|
1134 | LOG (llevError, "Got unknown value in map header: %s %s\n", key, value); |
1078 | LOG (llevError, "Got unknown value in map header: %s %s\n", key, value); |
1135 | } |
|
|
1136 | } |
1079 | } |
|
|
1080 | |
1137 | if (!key || strcmp (key, "end")) |
1081 | if (!key || strcmp (key, "end")) |
1138 | { |
1082 | { |
1139 | LOG (llevError, "Got premature eof on map header!\n"); |
1083 | LOG (llevError, "Got premature eof on map header!\n"); |
1140 | return 1; |
1084 | return 1; |
1141 | } |
1085 | } |
|
|
1086 | |
1142 | return 0; |
1087 | return 0; |
1143 | } |
1088 | } |
1144 | |
1089 | |
1145 | /* |
1090 | /* |
1146 | * Opens the file "filename" and reads information about the map |
1091 | * Opens the file "filename" and reads information about the map |
… | |
… | |
1298 | |
1243 | |
1299 | for (i = 0; i < MAP_WIDTH (m); i++) |
1244 | for (i = 0; i < MAP_WIDTH (m); i++) |
1300 | for (j = 0; j < MAP_HEIGHT (m); j++) |
1245 | for (j = 0; j < MAP_HEIGHT (m); j++) |
1301 | { |
1246 | { |
1302 | unique = 0; |
1247 | unique = 0; |
|
|
1248 | |
1303 | for (op = get_map_ob (m, i, j); op; op = next) |
1249 | for (op = GET_MAP_OB (m, i, j); op; op = next) |
1304 | { |
1250 | { |
1305 | next = op->above; |
1251 | next = op->above; |
|
|
1252 | |
1306 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
1253 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
1307 | unique = 1; |
1254 | unique = 1; |
|
|
1255 | |
1308 | if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) |
1256 | if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) |
1309 | { |
1257 | { |
1310 | clean_object (op); |
1258 | clean_object (op); |
|
|
1259 | |
1311 | if (QUERY_FLAG (op, FLAG_IS_LINKED)) |
1260 | if (QUERY_FLAG (op, FLAG_IS_LINKED)) |
1312 | remove_button_link (op); |
1261 | remove_button_link (op); |
1313 | op->remove (); |
1262 | |
1314 | op->destroy (0); |
1263 | op->destroy (); |
1315 | } |
1264 | } |
1316 | } |
1265 | } |
1317 | } |
1266 | } |
1318 | } |
1267 | } |
1319 | |
1268 | |
… | |
… | |
1388 | make_path_to_file (filename); |
1337 | make_path_to_file (filename); |
1389 | } |
1338 | } |
1390 | else |
1339 | else |
1391 | { |
1340 | { |
1392 | if (!m->tmpname) |
1341 | if (!m->tmpname) |
1393 | m->tmpname = tempnam_local (settings.tmpdir, NULL); |
1342 | m->tmpname = tempnam (settings.tmpdir, NULL); |
1394 | |
1343 | |
1395 | strcpy (filename, m->tmpname); |
1344 | strcpy (filename, m->tmpname); |
1396 | } |
1345 | } |
1397 | |
1346 | |
1398 | LOG (llevDebug, "Saving map %s to %s\n", m->path, filename); |
1347 | LOG (llevDebug, "Saving map %s to %s\n", m->path, filename); |
… | |
… | |
1514 | object *tmp, *next; |
1463 | object *tmp, *next; |
1515 | |
1464 | |
1516 | for (tmp = op->inv; tmp; tmp = next) |
1465 | for (tmp = op->inv; tmp; tmp = next) |
1517 | { |
1466 | { |
1518 | next = tmp->below; |
1467 | next = tmp->below; |
|
|
1468 | |
1519 | clean_object (tmp); |
1469 | clean_object (tmp); |
1520 | if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) |
1470 | if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) |
1521 | remove_button_link (tmp); |
1471 | remove_button_link (tmp); |
1522 | tmp->remove (); |
1472 | |
1523 | tmp->destroy (0); |
1473 | tmp->destroy (); |
1524 | } |
1474 | } |
1525 | } |
1475 | } |
1526 | |
1476 | |
1527 | /* |
1477 | /* |
1528 | * Remove and free all objects in the given map. |
1478 | * Remove and free all objects in the given map. |
… | |
… | |
1544 | if (op == previous_obj) |
1494 | if (op == previous_obj) |
1545 | { |
1495 | { |
1546 | LOG (llevDebug, "free_all_objects: Link error, bailing out.\n"); |
1496 | LOG (llevDebug, "free_all_objects: Link error, bailing out.\n"); |
1547 | break; |
1497 | break; |
1548 | } |
1498 | } |
|
|
1499 | |
1549 | previous_obj = op; |
1500 | previous_obj = op; |
|
|
1501 | |
1550 | if (op->head != NULL) |
1502 | if (op->head != NULL) |
1551 | op = op->head; |
1503 | op = op->head; |
1552 | |
1504 | |
1553 | /* If the map isn't in memory, free_object will remove and |
1505 | /* If the map isn't in memory, free_object will remove and |
1554 | * free objects in op's inventory. So let it do the job. |
1506 | * free objects in op's inventory. So let it do the job. |
1555 | */ |
1507 | */ |
1556 | if (m->in_memory == MAP_IN_MEMORY) |
1508 | if (m->in_memory == MAP_IN_MEMORY) |
1557 | clean_object (op); |
1509 | clean_object (op); |
1558 | op->remove (); |
1510 | |
1559 | op->destroy (0); |
1511 | op->destroy (); |
1560 | } |
1512 | } |
1561 | } |
1513 | } |
1562 | } |
1514 | } |
1563 | |
1515 | |
1564 | /* |
1516 | /* |
… | |
… | |
1574 | if (!m->in_memory) |
1526 | if (!m->in_memory) |
1575 | { |
1527 | { |
1576 | LOG (llevError, "Trying to free freed map.\n"); |
1528 | LOG (llevError, "Trying to free freed map.\n"); |
1577 | return; |
1529 | return; |
1578 | } |
1530 | } |
|
|
1531 | |
|
|
1532 | // TODO: use new/delete |
|
|
1533 | #define FREE_AND_CLEAR(p) { free (p); p = NULL; } |
|
|
1534 | |
1579 | if (flag && m->spaces) |
1535 | if (flag && m->spaces) |
1580 | free_all_objects (m); |
1536 | free_all_objects (m); |
1581 | if (m->name) |
1537 | if (m->name) |
1582 | FREE_AND_CLEAR (m->name); |
1538 | FREE_AND_CLEAR (m->name); |
1583 | if (m->spaces) |
1539 | if (m->spaces) |
1584 | FREE_AND_CLEAR (m->spaces); |
1540 | FREE_AND_CLEAR (m->spaces); |
1585 | if (m->msg) |
1541 | if (m->msg) |
1586 | FREE_AND_CLEAR (m->msg); |
1542 | FREE_AND_CLEAR (m->msg); |
1587 | if (m->maplore) |
1543 | if (m->maplore) |
1588 | FREE_AND_CLEAR (m->maplore); |
1544 | FREE_AND_CLEAR (m->maplore); |
1589 | if (m->shopitems) |
1545 | |
1590 | delete[]m->shopitems; |
1546 | delete [] m->shopitems; |
1591 | m->shopitems = 0; |
1547 | m->shopitems = 0; |
|
|
1548 | |
1592 | if (m->shoprace) |
1549 | if (m->shoprace) |
1593 | FREE_AND_CLEAR (m->shoprace); |
1550 | FREE_AND_CLEAR (m->shoprace); |
|
|
1551 | |
1594 | if (m->buttons) |
1552 | if (m->buttons) |
1595 | free_objectlinkpt (m->buttons); |
1553 | free_objectlinkpt (m->buttons); |
|
|
1554 | |
1596 | m->buttons = NULL; |
1555 | m->buttons = NULL; |
|
|
1556 | |
1597 | for (i = 0; i < 4; i++) |
1557 | for (i = 0; i < 4; i++) |
1598 | { |
1558 | { |
1599 | if (m->tile_path[i]) |
1559 | if (m->tile_path[i]) |
1600 | FREE_AND_CLEAR (m->tile_path[i]); |
1560 | FREE_AND_CLEAR (m->tile_path[i]); |
1601 | m->tile_map[i] = NULL; |
1561 | m->tile_map[i] = NULL; |
1602 | } |
1562 | } |
|
|
1563 | |
1603 | m->in_memory = MAP_SWAPPED; |
1564 | m->in_memory = MAP_SWAPPED; |
|
|
1565 | |
|
|
1566 | #undef FREE_AND_CLEAR |
|
|
1567 | |
1604 | } |
1568 | } |
1605 | |
1569 | |
1606 | /* |
1570 | /* |
1607 | * function: vanish maptile |
1571 | * function: vanish maptile |
1608 | * m : pointer to maptile, if NULL no action |
1572 | * m : pointer to maptile, if NULL no action |
… | |
… | |
1668 | else |
1632 | else |
1669 | last->next = m->next; |
1633 | last->next = m->next; |
1670 | |
1634 | |
1671 | delete m; |
1635 | delete m; |
1672 | } |
1636 | } |
1673 | |
|
|
1674 | |
|
|
1675 | |
1637 | |
1676 | /* |
1638 | /* |
1677 | * Makes sure the given map is loaded and swapped in. |
1639 | * Makes sure the given map is loaded and swapped in. |
1678 | * name is path name of the map. |
1640 | * name is path name of the map. |
1679 | * flags meaning: |
1641 | * flags meaning: |
… | |
… | |
1682 | * 0x2 (MAP_PLAYER_UNIQUE) - this is a unique map for each player. |
1644 | * 0x2 (MAP_PLAYER_UNIQUE) - this is a unique map for each player. |
1683 | * dont do any more name translation on it. |
1645 | * dont do any more name translation on it. |
1684 | * |
1646 | * |
1685 | * Returns a pointer to the given map. |
1647 | * Returns a pointer to the given map. |
1686 | */ |
1648 | */ |
1687 | |
|
|
1688 | maptile * |
1649 | maptile * |
1689 | ready_map_name (const char *name, int flags) |
1650 | ready_map_name (const char *name, int flags) |
1690 | { |
1651 | { |
1691 | maptile *m; |
1652 | maptile *m; |
1692 | |
1653 | |
… | |
… | |
1815 | return MAP_DIFFICULTY (m); |
1776 | return MAP_DIFFICULTY (m); |
1816 | } |
1777 | } |
1817 | |
1778 | |
1818 | for (x = 0; x < MAP_WIDTH (m); x++) |
1779 | for (x = 0; x < MAP_WIDTH (m); x++) |
1819 | for (y = 0; y < MAP_HEIGHT (m); y++) |
1780 | for (y = 0; y < MAP_HEIGHT (m); y++) |
1820 | for (op = get_map_ob (m, x, y); op != NULL; op = op->above) |
1781 | for (op = GET_MAP_OB (m, x, y); op != NULL; op = op->above) |
1821 | { |
1782 | { |
1822 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
1783 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
1823 | { |
1784 | { |
1824 | total_exp += op->stats.exp; |
1785 | total_exp += op->stats.exp; |
1825 | monster_cnt++; |
1786 | monster_cnt++; |
… | |
… | |
1918 | /* All clients need to get re-updated for the change */ |
1879 | /* All clients need to get re-updated for the change */ |
1919 | update_all_map_los (m); |
1880 | update_all_map_los (m); |
1920 | return 1; |
1881 | return 1; |
1921 | } |
1882 | } |
1922 | |
1883 | |
1923 | |
|
|
1924 | /* |
1884 | /* |
1925 | * This function updates various attributes about a specific space |
1885 | * This function updates various attributes about a specific space |
1926 | * on the map (what it looks like, whether it blocks magic, |
1886 | * on the map (what it looks like, whether it blocks magic, |
1927 | * has a living creatures, prevents people from passing |
1887 | * has a living creatures, prevents people from passing |
1928 | * through, etc) |
1888 | * through, etc) |
1929 | */ |
1889 | */ |
1930 | void |
1890 | void |
1931 | update_position (maptile *m, int x, int y) |
1891 | update_position (maptile *m, int x, int y) |
1932 | { |
1892 | { |
1933 | object *tmp, *last = NULL; |
1893 | object *tmp, *last = 0; |
1934 | uint8 flags = 0, oldflags, light = 0, anywhere = 0; |
1894 | uint8 flags = 0, oldflags, light = 0, anywhere = 0; |
1935 | New_Face *top, *floor, *middle; |
1895 | New_Face *top, *floor, *middle; |
1936 | object *top_obj, *floor_obj, *middle_obj; |
1896 | object *top_obj, *floor_obj, *middle_obj; |
1937 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1897 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1938 | |
1898 | |
… | |
… | |
1942 | LOG (llevDebug, "update_position called with P_NEED_UPDATE not set: %s (%d, %d)\n", m->path, x, y); |
1902 | LOG (llevDebug, "update_position called with P_NEED_UPDATE not set: %s (%d, %d)\n", m->path, x, y); |
1943 | return; |
1903 | return; |
1944 | } |
1904 | } |
1945 | |
1905 | |
1946 | middle = blank_face; |
1906 | middle = blank_face; |
1947 | top = blank_face; |
1907 | top = blank_face; |
1948 | floor = blank_face; |
1908 | floor = blank_face; |
1949 | |
1909 | |
1950 | middle_obj = NULL; |
1910 | middle_obj = 0; |
1951 | top_obj = NULL; |
1911 | top_obj = 0; |
1952 | floor_obj = NULL; |
1912 | floor_obj = 0; |
1953 | |
1913 | |
1954 | for (tmp = get_map_ob (m, x, y); tmp; last = tmp, tmp = tmp->above) |
1914 | for (tmp = GET_MAP_OB (m, x, y); tmp; last = tmp, tmp = tmp->above) |
1955 | { |
1915 | { |
1956 | |
|
|
1957 | /* This could be made additive I guess (two lights better than |
1916 | /* This could be made additive I guess (two lights better than |
1958 | * one). But if so, it shouldn't be a simple additive - 2 |
1917 | * one). But if so, it shouldn't be a simple additive - 2 |
1959 | * light bulbs do not illuminate twice as far as once since |
1918 | * light bulbs do not illuminate twice as far as once since |
1960 | * it is a disapation factor that is squared (or is it cubed?) |
1919 | * it is a dissapation factor that is cubed. |
1961 | */ |
1920 | */ |
1962 | if (tmp->glow_radius > light) |
1921 | if (tmp->glow_radius > light) |
1963 | light = tmp->glow_radius; |
1922 | light = tmp->glow_radius; |
1964 | |
1923 | |
1965 | /* This call is needed in order to update objects the player |
1924 | /* This call is needed in order to update objects the player |
… | |
… | |
2003 | { |
1962 | { |
2004 | middle = tmp->face; |
1963 | middle = tmp->face; |
2005 | middle_obj = tmp; |
1964 | middle_obj = tmp; |
2006 | } |
1965 | } |
2007 | } |
1966 | } |
|
|
1967 | |
2008 | if (tmp == tmp->above) |
1968 | if (tmp == tmp->above) |
2009 | { |
1969 | { |
2010 | LOG (llevError, "Error in structure of map\n"); |
1970 | LOG (llevError, "Error in structure of map\n"); |
2011 | exit (-1); |
1971 | exit (-1); |
2012 | } |
1972 | } |
2013 | |
1973 | |
2014 | move_slow |= tmp->move_slow; |
1974 | move_slow |= tmp->move_slow; |
2015 | move_block |= tmp->move_block; |
1975 | move_block |= tmp->move_block; |
2016 | move_on |= tmp->move_on; |
1976 | move_on |= tmp->move_on; |
2017 | move_off |= tmp->move_off; |
1977 | move_off |= tmp->move_off; |
2018 | move_allow |= tmp->move_allow; |
1978 | move_allow |= tmp->move_allow; |
2019 | |
1979 | |
2020 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
|
|
2021 | flags |= P_IS_ALIVE; |
|
|
2022 | if (QUERY_FLAG (tmp, FLAG_NO_MAGIC)) |
|
|
2023 | flags |= P_NO_MAGIC; |
|
|
2024 | if (QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
2025 | flags |= P_NO_CLERIC; |
|
|
2026 | if (tmp->type == SAFE_GROUND) |
|
|
2027 | flags |= P_SAFE; |
|
|
2028 | |
|
|
2029 | if (QUERY_FLAG (tmp, FLAG_BLOCKSVIEW)) |
1980 | if (QUERY_FLAG (tmp, FLAG_BLOCKSVIEW)) flags |= P_BLOCKSVIEW; |
2030 | flags |= P_BLOCKSVIEW; |
1981 | if (QUERY_FLAG (tmp, FLAG_NO_MAGIC)) flags |= P_NO_MAGIC; |
2031 | } /* for stack of objects */ |
1982 | if (tmp->type == PLAYER) flags |= P_PLAYER; |
|
|
1983 | if (tmp->type == SAFE_GROUND) flags |= P_SAFE; |
|
|
1984 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) flags |= P_IS_ALIVE; |
|
|
1985 | if (QUERY_FLAG (tmp, FLAG_DAMNED)) flags |= P_NO_CLERIC; |
|
|
1986 | } |
2032 | |
1987 | |
2033 | /* we don't want to rely on this function to have accurate flags, but |
1988 | /* we don't want to rely on this function to have accurate flags, but |
2034 | * since we're already doing the work, we calculate them here. |
1989 | * since we're already doing the work, we calculate them here. |
2035 | * if they don't match, logic is broken someplace. |
1990 | * if they don't match, logic is broken someplace. |
2036 | */ |
1991 | */ |
2037 | if (((oldflags & ~(P_NEED_UPDATE | P_NO_ERROR)) != flags) && (!(oldflags & P_NO_ERROR))) |
1992 | if (((oldflags & ~(P_NEED_UPDATE | P_NO_ERROR)) != flags) && (!(oldflags & P_NO_ERROR))) |
2038 | { |
|
|
2039 | LOG (llevDebug, "update_position: updated flags do not match old flags: %s (old=%d,new=%d) %x != %x\n", |
1993 | LOG (llevDebug, "update_position: updated flags do not match old flags: %s (old=%d,new=%d) %x != %x\n", |
2040 | m->path, x, y, (oldflags & ~P_NEED_UPDATE), flags); |
1994 | m->path, x, y, (oldflags & ~P_NEED_UPDATE), flags); |
2041 | } |
1995 | |
2042 | SET_MAP_FLAGS (m, x, y, flags); |
1996 | mapspace &s = m->at (x, y); |
2043 | SET_MAP_MOVE_BLOCK (m, x, y, move_block & ~move_allow); |
1997 | |
2044 | SET_MAP_MOVE_ON (m, x, y, move_on); |
1998 | s.flags = flags; |
2045 | SET_MAP_MOVE_OFF (m, x, y, move_off); |
1999 | s.move_block = move_block & ~move_allow; |
2046 | SET_MAP_MOVE_SLOW (m, x, y, move_slow); |
2000 | s.move_on = move_on; |
|
|
2001 | s.move_off = move_off; |
|
|
2002 | s.move_slow = move_slow; |
2047 | |
2003 | |
2048 | /* At this point, we have a floor face (if there is a floor), |
2004 | /* At this point, we have a floor face (if there is a floor), |
2049 | * and the floor is set - we are not going to touch it at |
2005 | * and the floor is set - we are not going to touch it at |
2050 | * this point. |
2006 | * this point. |
2051 | * middle contains the highest visibility face. |
2007 | * middle contains the highest visibility face. |
… | |
… | |
2105 | break; |
2061 | break; |
2106 | } |
2062 | } |
2107 | } |
2063 | } |
2108 | } |
2064 | } |
2109 | } |
2065 | } |
|
|
2066 | |
2110 | if (middle == floor) |
2067 | if (middle == floor) |
2111 | middle = blank_face; |
2068 | middle = blank_face; |
|
|
2069 | |
2112 | if (top == middle) |
2070 | if (top == middle) |
2113 | middle = blank_face; |
2071 | middle = blank_face; |
|
|
2072 | |
2114 | SET_MAP_FACE (m, x, y, top, 0); |
2073 | SET_MAP_FACE (m, x, y, top, 0); |
2115 | if (top != blank_face) |
2074 | if (top != blank_face) |
2116 | SET_MAP_FACE_OBJ (m, x, y, top_obj, 0); |
2075 | SET_MAP_FACE_OBJ (m, x, y, top_obj, 0); |
2117 | else |
2076 | else |
2118 | SET_MAP_FACE_OBJ (m, x, y, NULL, 0); |
2077 | SET_MAP_FACE_OBJ (m, x, y, NULL, 0); |
|
|
2078 | |
2119 | SET_MAP_FACE (m, x, y, middle, 1); |
2079 | SET_MAP_FACE (m, x, y, middle, 1); |
2120 | if (middle != blank_face) |
2080 | if (middle != blank_face) |
2121 | SET_MAP_FACE_OBJ (m, x, y, middle_obj, 1); |
2081 | SET_MAP_FACE_OBJ (m, x, y, middle_obj, 1); |
2122 | else |
2082 | else |
2123 | SET_MAP_FACE_OBJ (m, x, y, NULL, 1); |
2083 | SET_MAP_FACE_OBJ (m, x, y, NULL, 1); |
|
|
2084 | |
2124 | SET_MAP_FACE (m, x, y, floor, 2); |
2085 | SET_MAP_FACE (m, x, y, floor, 2); |
2125 | if (floor != blank_face) |
2086 | if (floor != blank_face) |
2126 | SET_MAP_FACE_OBJ (m, x, y, floor_obj, 2); |
2087 | SET_MAP_FACE_OBJ (m, x, y, floor_obj, 2); |
2127 | else |
2088 | else |
2128 | SET_MAP_FACE_OBJ (m, x, y, NULL, 2); |
2089 | SET_MAP_FACE_OBJ (m, x, y, NULL, 2); |
|
|
2090 | |
2129 | SET_MAP_LIGHT (m, x, y, light); |
2091 | SET_MAP_LIGHT (m, x, y, light); |
2130 | } |
2092 | } |
2131 | |
2093 | |
2132 | |
2094 | |
2133 | void |
2095 | void |
… | |
… | |
2138 | timeout = MAP_RESET_TIMEOUT (map); |
2100 | timeout = MAP_RESET_TIMEOUT (map); |
2139 | if (timeout <= 0) |
2101 | if (timeout <= 0) |
2140 | timeout = MAP_DEFAULTRESET; |
2102 | timeout = MAP_DEFAULTRESET; |
2141 | if (timeout >= MAP_MAXRESET) |
2103 | if (timeout >= MAP_MAXRESET) |
2142 | timeout = MAP_MAXRESET; |
2104 | timeout = MAP_MAXRESET; |
2143 | MAP_WHEN_RESET (map) = seconds () + timeout; |
2105 | MAP_WHEN_RESET (map) = time (0) + timeout; |
2144 | } |
2106 | } |
2145 | |
2107 | |
2146 | /* this updates the orig_map->tile_map[tile_num] value after loading |
2108 | /* this updates the orig_map->tile_map[tile_num] value after loading |
2147 | * the map. It also takes care of linking back the freshly loaded |
2109 | * the map. It also takes care of linking back the freshly loaded |
2148 | * maps tile_map values if it tiles back to this one. It returns |
2110 | * maps tile_map values if it tiles back to this one. It returns |