MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SaveData

Method SaveData

Descent3/matcen.cpp:735–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733void matcen::GetName(char *name) { strcpy(name, m_name); }
734
735void matcen::SaveData(CFILE *fp) {
736 int i, j;
737 int len;
738
739 cf_WriteInt(fp, MATCEN_LOADSAVE_VERSION);
740
741 cf_WriteShort(fp, MAX_SPAWN_PNTS);
742 cf_WriteShort(fp, MAX_PROD_TYPES);
743 cf_WriteShort(fp, MAX_MATCEN_SOUNDS);
744
745 len = strlen(m_name) + 1; // Accounts for NULL charactor
746 cf_WriteShort(fp, len);
747 for (i = 0; i < len; i++) {
748 cf_WriteByte(fp, m_name[i]);
749 }
750
751 cf_WriteByte(fp, m_num_prod_types);
752 cf_WriteByte(fp, m_control_type);
753 cf_WriteByte(fp, m_type);
754 cf_WriteByte(fp, m_creation_effect);
755 cf_WriteShort(fp, m_creation_texture);
756
757 cf_WriteInt(fp, m_num_spawn_pnts);
758
759 cf_WriteInt(fp, m_roomnum);
760
761 cf_WriteFloat(fp, m_create_pnt.x);
762 cf_WriteFloat(fp, m_create_pnt.y);
763 cf_WriteFloat(fp, m_create_pnt.z);
764
765 cf_WriteInt(fp, m_create_room);
766
767 for (i = 0; i < MAX_SPAWN_PNTS; i++) {
768 cf_WriteInt(fp, m_spawn_pnt[i]);
769
770 cf_WriteFloat(fp, m_spawn_vec[i].x);
771 cf_WriteFloat(fp, m_spawn_vec[i].y);
772 cf_WriteFloat(fp, m_spawn_vec[i].x);
773
774 cf_WriteFloat(fp, m_spawn_normal[i].x);
775 cf_WriteFloat(fp, m_spawn_normal[i].y);
776 cf_WriteFloat(fp, m_spawn_normal[i].x);
777 }
778
779 cf_WriteInt(fp, m_max_prod);
780
781 for (i = 0; i < MAX_PROD_TYPES; i++) {
782 int type = m_prod_type[i];
783
784 if (type >= 0) {
785 len = strlen(Object_info[type].name) + 1; // Accounts for NULL charactor
786 cf_WriteShort(fp, len);
787 for (j = 0; j < len; j++) {
788 cf_WriteByte(fp, Object_info[type].name[j]);
789 }
790 } else {
791 cf_WriteShort(fp, 1);
792 cf_WriteByte(fp, '\0');

Callers 3

SGSMatcensFunction · 0.45
WriteMatcenChunkFunction · 0.45
WriteALifeChunkFunction · 0.45

Calls 4

cf_WriteIntFunction · 0.85
cf_WriteShortFunction · 0.85
cf_WriteByteFunction · 0.85
cf_WriteFloatFunction · 0.85

Tested by

no test coverage detected