save viseffects
| 733 | |
| 734 | // save viseffects |
| 735 | int LGSVisEffects(CFILE *fp) { |
| 736 | int16_t i, count = 0; |
| 737 | |
| 738 | gs_ReadShort(fp, count); |
| 739 | |
| 740 | // reassemble viseffect list. |
| 741 | for (i = 0; i < count; i++) { |
| 742 | int roomnum, v; |
| 743 | vis_effect vis; |
| 744 | |
| 745 | cf_ReadBytes((uint8_t *)&vis, sizeof(vis_effect), fp); |
| 746 | roomnum = vis.roomnum; |
| 747 | |
| 748 | // Check for old struct, and if found, fix it |
| 749 | if ((vis.type != VIS_FIREBALL) || (roomnum == -1) || |
| 750 | (!ROOMNUM_OUTSIDE(roomnum) && ((roomnum > Highest_room_index) || !Rooms[roomnum].used)) || |
| 751 | ((ROOMNUM_OUTSIDE(roomnum) && (CELLNUM(roomnum) > 65535)))) { |
| 752 | old_vis_effect old_vis; |
| 753 | |
| 754 | // Copy new into old |
| 755 | memcpy((uint8_t *)&old_vis, (uint8_t *)&vis, sizeof(vis_effect)); |
| 756 | |
| 757 | // Read extra data from old |
| 758 | cf_ReadBytes(((uint8_t *)&old_vis) + sizeof(vis_effect), sizeof(old_vis_effect) - sizeof(vis_effect), fp); |
| 759 | |
| 760 | // Copy from old to new struct |
| 761 | CopyVisStruct(&vis, &old_vis); |
| 762 | |
| 763 | // Reset new room number |
| 764 | roomnum = vis.roomnum; |
| 765 | } |
| 766 | |
| 767 | vis.roomnum = vis.prev = vis.next = -1; |
| 768 | v = VisEffectAllocate(); |
| 769 | if (v >= 0) { // DAJ -1FIX |
| 770 | memcpy(&VisEffects[v], &vis, sizeof(vis_effect)); |
| 771 | VisEffectLink(v, roomnum); |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | return LGS_OK; |
| 776 | } |
| 777 | |
| 778 | // players |
| 779 | int LGSPlayers(CFILE *fp) { |
no test coverage detected