saves out objects
| 1011 | |
| 1012 | // saves out objects |
| 1013 | void SGSObjects(CFILE *fp) { |
| 1014 | int i, j; |
| 1015 | |
| 1016 | START_VERIFY_SAVEFILE(fp); |
| 1017 | |
| 1018 | // Save marker info (text) |
| 1019 | cf_WriteInt(fp, Marker_message); |
| 1020 | cf_WriteShort(fp, (int16_t)MAX_PLAYERS * 2); |
| 1021 | for (i = 0; i < MAX_PLAYERS * 2; i++) { |
| 1022 | cf_WriteShort(fp, strlen(MarkerMessages[i]) + 1); |
| 1023 | cf_WriteBytes((uint8_t *)MarkerMessages[i], strlen(MarkerMessages[i]) + 1, fp); |
| 1024 | } |
| 1025 | |
| 1026 | // this method should maintain the object list as it currently stands in the level |
| 1027 | cf_WriteShort(fp, (int16_t)Highest_object_index); |
| 1028 | |
| 1029 | // save what objects are stuck to each other |
| 1030 | cf_WriteInt(fp, MAX_OBJECTS); |
| 1031 | cf_WriteInt(fp, Physics_NumLinked); |
| 1032 | for (i = 0; i < MAX_OBJECTS; i++) { |
| 1033 | cf_WriteInt(fp, PhysicsLinkList[i]); |
| 1034 | } |
| 1035 | |
| 1036 | // save AI information |
| 1037 | ////////////////////////////////// |
| 1038 | cf_WriteInt(fp, MAX_DYNAMIC_PATHS); |
| 1039 | cf_WriteInt(fp, MAX_NODES); |
| 1040 | |
| 1041 | int s; |
| 1042 | for (i = 0; i < MAX_DYNAMIC_PATHS; i++) { |
| 1043 | cf_WriteShort(fp, AIDynamicPath[i].num_nodes); |
| 1044 | cf_WriteShort(fp, AIDynamicPath[i].use_count); |
| 1045 | cf_WriteInt(fp, AIDynamicPath[i].owner_handle); |
| 1046 | |
| 1047 | for (s = 0; s < MAX_NODES; s++) { |
| 1048 | cf_WriteFloat(fp, AIDynamicPath[i].pos[s].x); |
| 1049 | cf_WriteFloat(fp, AIDynamicPath[i].pos[s].y); |
| 1050 | cf_WriteFloat(fp, AIDynamicPath[i].pos[s].z); |
| 1051 | cf_WriteInt(fp, AIDynamicPath[i].roomnum[s]); |
| 1052 | } |
| 1053 | } |
| 1054 | |
| 1055 | cf_WriteInt(fp, MAX_ROOMS); |
| 1056 | cf_WriteInt(fp, AIAltPathNumNodes); |
| 1057 | |
| 1058 | for (i = 0; i < MAX_ROOMS; i++) { |
| 1059 | cf_WriteInt(fp, AIAltPath[i]); |
| 1060 | } |
| 1061 | |
| 1062 | /////////////////////////////////// |
| 1063 | |
| 1064 | for (i = 0; i <= Highest_object_index; i++) { |
| 1065 | object *op = &Objects[i]; |
| 1066 | poly_model *pm = &Poly_models[op->rtype.pobj_info.model_num]; |
| 1067 | |
| 1068 | gs_WriteInt(fp, 0xBADB0B); |
| 1069 | // we don't save deleted objects or room objects since they're reconstructed on loadlevel |
| 1070 | gs_WriteByte(fp, (int8_t)op->type); |
no test coverage detected