… | |
… | |
509 | { |
509 | { |
510 | keyword kw = thawer.get_kv (); |
510 | keyword kw = thawer.get_kv (); |
511 | |
511 | |
512 | switch (kw) |
512 | switch (kw) |
513 | { |
513 | { |
|
|
514 | case KW_Object: // uppercase alias |
514 | case KW_object: |
515 | case KW_object: |
515 | thawer.get (op->name); |
516 | thawer.get (op->name); |
516 | |
517 | |
517 | if (op->arch != NULL) |
518 | if (op->arch != NULL) |
518 | op->arch->name = op->name; |
519 | op->arch->name = op->name; |
… | |
… | |
554 | } |
555 | } |
555 | |
556 | |
556 | parse_object (tmp, thawer, map_flags); |
557 | parse_object (tmp, thawer, map_flags); |
557 | |
558 | |
558 | if (tmp->arch) |
559 | if (tmp->arch) |
|
|
560 | { |
559 | insert_ob_in_ob (tmp, op); |
561 | // was: insert_ob_in_ob (tmp, op); |
|
|
562 | // but manually adding it can improve map loading times a lot |
|
|
563 | CLEAR_FLAG (tmp, FLAG_OBJ_ORIGINAL); |
|
|
564 | CLEAR_FLAG (tmp, FLAG_REMOVED); |
|
|
565 | tmp->env = op; |
|
|
566 | |
|
|
567 | if (!op->inv) |
|
|
568 | op->inv = tmp; |
|
|
569 | else |
|
|
570 | { |
|
|
571 | tmp->below = op->inv; |
|
|
572 | tmp->below->above = tmp; |
|
|
573 | op->inv = tmp; |
|
|
574 | } |
|
|
575 | } |
560 | else |
576 | else |
561 | { |
577 | { |
562 | LOG (llevDebug, "Discarding object without arch: %s\n", |
578 | LOG (llevDebug, "Discarding object without arch: %s\n", |
563 | tmp->name ? (const char *) tmp->name : "(null)"); |
579 | tmp->name ? (const char *) tmp->name : "(null)"); |
564 | free_object (tmp); |
580 | free_object (tmp); |
… | |
… | |
624 | op->move_slow |= MOVE_WALK; |
640 | op->move_slow |= MOVE_WALK; |
625 | thawer.get (op->move_slow_penalty); |
641 | thawer.get (op->move_slow_penalty); |
626 | break; |
642 | break; |
627 | |
643 | |
628 | case KW_face: |
644 | case KW_face: |
|
|
645 | if (const char *str = thawer.get_str ()) |
629 | op->face = &new_faces[FindFace (thawer.get_str (), 0)]; |
646 | op->face = &new_faces[FindFace (str, 0)]; |
|
|
647 | else |
|
|
648 | op->face = 0; |
630 | break; |
649 | break; |
631 | |
650 | |
632 | case KW_x: thawer.get (op->x); break; |
651 | case KW_x: thawer.get (op->x); break; |
633 | case KW_y: thawer.get (op->y); break; |
652 | case KW_y: thawer.get (op->y); break; |
|
|
653 | case KW_Str: // uppercase alias |
634 | case KW_str: thawer.get (op->stats.Str); break; |
654 | case KW_str: thawer.get (op->stats.Str); break; |
|
|
655 | case KW_Dex: // uppercase alias |
635 | case KW_dex: thawer.get (op->stats.Dex); break; |
656 | case KW_dex: thawer.get (op->stats.Dex); break; |
|
|
657 | case KW_Con: // uppercase alias |
636 | case KW_con: thawer.get (op->stats.Con); break; |
658 | case KW_con: thawer.get (op->stats.Con); break; |
|
|
659 | case KW_Wis: // uppercase alias |
637 | case KW_wis: thawer.get (op->stats.Wis); break; |
660 | case KW_wis: thawer.get (op->stats.Wis); break; |
|
|
661 | case KW_Cha: // uppercase alias |
638 | case KW_cha: thawer.get (op->stats.Cha); break; |
662 | case KW_cha: thawer.get (op->stats.Cha); break; |
|
|
663 | case KW_Int: // uppercase alias |
639 | case KW_int: thawer.get (op->stats.Int); break; |
664 | case KW_int: thawer.get (op->stats.Int); break; |
|
|
665 | case KW_Pow: // uppercase alias |
640 | case KW_pow: thawer.get (op->stats.Pow); break; |
666 | case KW_pow: thawer.get (op->stats.Pow); break; |
641 | case KW_hp: thawer.get (op->stats.hp); break; |
667 | case KW_hp: thawer.get (op->stats.hp); break; |
642 | case KW_maxhp: thawer.get (op->stats.maxhp); break; |
668 | case KW_maxhp: thawer.get (op->stats.maxhp); break; |
643 | case KW_sp: thawer.get (op->stats.sp); break; |
669 | case KW_sp: thawer.get (op->stats.sp); break; |
644 | case KW_maxsp: thawer.get (op->stats.maxsp); break; |
670 | case KW_maxsp: thawer.get (op->stats.maxsp); break; |
… | |
… | |
965 | |
991 | |
966 | case KW_editable: |
992 | case KW_editable: |
967 | case KW_editor_folder: |
993 | case KW_editor_folder: |
968 | break; |
994 | break; |
969 | |
995 | |
|
|
996 | case KW_More: // uppercase alias |
970 | case KW_more: |
997 | case KW_more: |
971 | /* We need to record that this is a multipart object, |
998 | /* We need to record that this is a multipart object, |
972 | * so the calling function can glue things back together |
999 | * so the calling function can glue things back together |
973 | */ |
1000 | */ |
974 | ismore = 1; |
1001 | ismore = 1; |
… | |
… | |
984 | |
1011 | |
985 | case KW_EOF: |
1012 | case KW_EOF: |
986 | return LL_EOF; |
1013 | return LL_EOF; |
987 | |
1014 | |
988 | case KW_ERROR: |
1015 | case KW_ERROR: |
989 | set_ob_key_value(op, thawer.line, thawer.last_value, true); |
1016 | set_ob_key_value (op, thawer.line, thawer.last_value, true); |
990 | //printf ("addkv(%s,%s)\n", thawer.line, thawer.get_str());//D |
1017 | //printf ("addkv(%s,%s)\n", thawer.line, thawer.get_str());//D |
991 | |
1018 | |
992 | // skip line, ugly |
1019 | //TODO: skip line, ugly, factor parsing better |
|
|
1020 | if (thawer.last_value) |
|
|
1021 | thawer.line = thawer.last_value; |
|
|
1022 | |
993 | thawer.line = thawer.last_value + strlen (thawer.last_value) + 1; |
1023 | thawer.line += strlen (thawer.line) + 1; |
|
|
1024 | |
994 | break; |
1025 | break; |
995 | |
1026 | |
996 | default: |
1027 | default: |
997 | printf ("kw abort %d\n", kw);//D |
1028 | LOG (llevError, "UNSUPPORTED KEYWORD IN MAP: \"%s\", bug in normaliser. skipping.\n", keyword_str [kw]); |
998 | abort (); |
1029 | break; |
999 | } |
1030 | } |
1000 | } |
1031 | } |
1001 | } |
1032 | } |
1002 | |
1033 | |
1003 | /* |
1034 | /* |
… | |
… | |
1024 | * as appropriate in op. |
1055 | * as appropriate in op. |
1025 | * |
1056 | * |
1026 | * This function appears to be used in only 2 places - in crossedit to |
1057 | * This function appears to be used in only 2 places - in crossedit to |
1027 | * override values and in c_wiz to mutate values. |
1058 | * override values and in c_wiz to mutate values. |
1028 | */ |
1059 | */ |
|
|
1060 | int |
1029 | int set_variable(object *op,char *buf) { |
1061 | set_variable(object *op, char *buf) |
|
|
1062 | { |
|
|
1063 | return 0; |
1030 | #if 0 |
1064 | #if 0 |
1031 | int retval; |
1065 | int retval; |
1032 | object_thawer thawer (0); |
1066 | object_thawer thawer (0); |
1033 | |
1067 | |
1034 | strcpy(msgbuf, ""); |
1068 | strcpy(msgbuf, ""); |
… | |
… | |
1091 | |
1125 | |
1092 | void init_vars() { |
1126 | void init_vars() { |
1093 | } |
1127 | } |
1094 | |
1128 | |
1095 | /* This returns a string of the integer movement type */ |
1129 | /* This returns a string of the integer movement type */ |
|
|
1130 | #if 0 |
|
|
1131 | // unused function |
1096 | static char* get_string_move_type(MoveType mt) |
1132 | static char* get_string_move_type(MoveType mt) |
1097 | { |
1133 | { |
1098 | static char retbuf[MAX_BUF], retbuf_all[MAX_BUF]; |
1134 | static char retbuf[MAX_BUF], retbuf_all[MAX_BUF]; |
1099 | int i, all_count=0, count; |
1135 | int i, all_count=0, count; |
1100 | |
1136 | |
… | |
… | |
1128 | * 'all -walk -fly_low' - it is shorter to return 'fly_high swim' |
1164 | * 'all -walk -fly_low' - it is shorter to return 'fly_high swim' |
1129 | */ |
1165 | */ |
1130 | if (all_count <=1) return retbuf_all+1; |
1166 | if (all_count <=1) return retbuf_all+1; |
1131 | else return retbuf+1; |
1167 | else return retbuf+1; |
1132 | } |
1168 | } |
1133 | |
1169 | #endif |
1134 | |
1170 | |
1135 | // compare *op against *tmp and output differences |
1171 | // compare *op against *tmp and output differences |
1136 | void |
1172 | void |
1137 | put (object_freezer &f, object *op, object *tmp) |
1173 | put (object_freezer &f, object *op, object *tmp) |
1138 | { |
1174 | { |
… | |
… | |
1169 | if (op->lore != tmp->lore) f.put (KW_lore, KW_endlore, op->lore); |
1205 | if (op->lore != tmp->lore) f.put (KW_lore, KW_endlore, op->lore); |
1170 | |
1206 | |
1171 | CMP_OUT (other_arch); |
1207 | CMP_OUT (other_arch); |
1172 | CMP_OUT (face); |
1208 | CMP_OUT (face); |
1173 | |
1209 | |
|
|
1210 | if (!op->face || !op->face->name) |
|
|
1211 | printf ("ERRFACE<%s,%s, face %p,%p, fname%s>\n", &tmp->name, &op->name, tmp->face, op->face, op->face ? &op->face->name : "<noface>");//D |
|
|
1212 | |
1174 | if (op->animation_id != tmp->animation_id) |
1213 | if (op->animation_id != tmp->animation_id) |
1175 | if (op->animation_id) |
1214 | if (op->animation_id) |
1176 | { |
1215 | { |
1177 | f.put (KW_animation, animations[GET_ANIM_ID (op)].name); |
1216 | f.put (KW_animation, animations[GET_ANIM_ID (op)].name); |
1178 | |
1217 | |
1179 | if (!QUERY_FLAG (op, FLAG_ANIMATE)) |
1218 | if (!QUERY_FLAG (op, FLAG_ANIMATE)) |
1180 | f.put (KW_is_animated, 0); |
1219 | f.put (KW_is_animated, (sint32)0); |
1181 | } |
1220 | } |
1182 | else |
1221 | else |
1183 | f.put (KW_animation, "NONE"); |
1222 | f.put (KW_animation, (const char *)0); |
1184 | |
1223 | |
1185 | CMP_OUT2 (str , stats.Str); |
1224 | CMP_OUT2 (str , stats.Str); |
1186 | CMP_OUT2 (dex , stats.Dex); |
1225 | CMP_OUT2 (dex , stats.Dex); |
1187 | CMP_OUT2 (con , stats.Con); |
1226 | CMP_OUT2 (con , stats.Con); |
1188 | CMP_OUT2 (wis , stats.Wis); |
1227 | CMP_OUT2 (wis , stats.Wis); |
… | |
… | |
1272 | |
1311 | |
1273 | if (!COMPARE_FLAGS (op, tmp)) |
1312 | if (!COMPARE_FLAGS (op, tmp)) |
1274 | for (i = 0; i <= NUM_FLAGS; i++) |
1313 | for (i = 0; i <= NUM_FLAGS; i++) |
1275 | if (flag_names [i] |
1314 | if (flag_names [i] |
1276 | && (QUERY_FLAG (op, i) != QUERY_FLAG (tmp, i))) |
1315 | && (QUERY_FLAG (op, i) != QUERY_FLAG (tmp, i))) |
1277 | f.put (flag_names [i], QUERY_FLAG (op, i) ? "1" : 0); |
1316 | f.put (flag_names [i], QUERY_FLAG (op, i) ? "1" : "0"); |
1278 | |
1317 | |
1279 | /* Save body locations */ |
1318 | /* Save body locations */ |
1280 | for (i = 0; i < NUM_BODY_LOCATIONS; i++) |
1319 | for (i = 0; i < NUM_BODY_LOCATIONS; i++) |
1281 | if (op->body_info[i] != tmp->body_info[i]) |
1320 | if (op->body_info[i] != tmp->body_info[i]) |
1282 | f.put (body_locations[i].save_name, op->body_info[i]); |
1321 | f.put (body_locations[i].save_name, op->body_info[i]); |