- x = 200 + i * rope_offset;
- y = 40 + j * string_length;
- index = i * num_rope_objects + j;
- model->objects[index].position.x = x;
- model->objects[index].position.y = y;
- model->objects[index].previous_position.x = x;
- model->objects[index].previous_position.y = y;
- model->objects[index].mass = 1;
-
- if (i + 1 < num_ropes) {
- string_index = i * num_rope_objects + j;
- model->strings[string_index].a = &model->objects[index];
- model->strings[string_index].b = &model->objects[index + num_rope_objects];
- model->strings[string_index].length = string_length;
- }
-
- if (j + 1 < num_rope_objects) {
- string_index =
- (num_ropes - 1) * num_rope_objects + i * (num_rope_objects - 1) + j;
- model->strings[string_index].a = &model->objects[index];
- model->strings[string_index].b = &model->objects[index + 1];
- model->strings[string_index].length = string_length;
- }
+ object_init (object, 200 + i * rope_offset, 40 + j * string_length, 1);
+
+ if (i + 1 < num_ropes)
+ string_init (string++,
+ object, object + num_rope_objects, string_length);
+ if (j + 1 < num_rope_objects)
+ string_init (string++, object, object + 1, string_length);
+ object++;