+static int LoadLevel_CUS1(FILE *file, int chunk_size, struct LevelInfo *level)
+{
+ int num_changed_custom_elements = getFile16BitBE(file);
+ int chunk_size_expected = 2 + num_changed_custom_elements * 6;
+ int i;
+
+ if (chunk_size_expected != chunk_size)
+ {
+ ReadUnusedBytesFromFile(file, chunk_size - 2);
+ return chunk_size_expected;
+ }
+
+ for (i=0; i < num_changed_custom_elements; i++)
+ {
+ int element = getFile16BitBE(file);
+ int properties = getFile32BitBE(file);
+
+ if (IS_CUSTOM_ELEMENT(element))
+ Properties[element][EP_BITFIELD_BASE] = properties;
+ else
+ Error(ERR_WARN, "invalid custom element number %d", element);
+ }
+
+ return chunk_size;
+}
+
+static int LoadLevel_CUS2(FILE *file, int chunk_size, struct LevelInfo *level)
+{
+ int num_changed_custom_elements = getFile16BitBE(file);
+ int chunk_size_expected = 2 + num_changed_custom_elements * 4;
+ int i;
+
+ if (chunk_size_expected != chunk_size)
+ {
+ ReadUnusedBytesFromFile(file, chunk_size - 2);
+ return chunk_size_expected;
+ }
+
+ for (i=0; i < num_changed_custom_elements; i++)
+ {
+ int element = getFile16BitBE(file);
+ int custom_element_successor = getFile16BitBE(file);
+
+ if (IS_CUSTOM_ELEMENT(element))
+ element_info[element].change.successor = custom_element_successor;
+ else
+ Error(ERR_WARN, "invalid custom element number %d", element);
+ }
+
+ return chunk_size;
+}
+