Skip to content

Commit

Permalink
Upgraded Asteroid Field SEXPs (#6295)
Browse files Browse the repository at this point in the history
* upgrade asteroid sexps to match new asteroid field features

* clang is a needy boy

* unify the sexp operators into one since there are minimal changes

* cleanup for readability

* address feedback
  • Loading branch information
MjnMixael authored Aug 27, 2024
1 parent 40bbced commit d68b18d
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 92 deletions.
14 changes: 2 additions & 12 deletions code/asteroid/asteroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ void remove_all_asteroids()
}

// will replace any existing asteroid or debris field with an asteroid field
void asteroid_create_asteroid_field(int num_asteroids, int field_type, int asteroid_speed, bool brown, bool blue, bool orange, vec3d o_min, vec3d o_max, bool inner_box, vec3d i_min, vec3d i_max, SCP_vector<SCP_string> targets)
void asteroid_create_asteroid_field(int num_asteroids, int field_type, int asteroid_speed, vec3d o_min, vec3d o_max, bool inner_box, vec3d i_min, vec3d i_max, SCP_vector<SCP_string> asteroid_types)
{
remove_all_asteroids();

Expand Down Expand Up @@ -740,15 +740,7 @@ void asteroid_create_asteroid_field(int num_asteroids, int field_type, int aster

Asteroid_field.field_asteroid_type.clear();

if (brown) {
Asteroid_field.field_asteroid_type.push_back("Brown");
}
if (blue) {
Asteroid_field.field_asteroid_type.push_back("Blue");
}
if (orange) {
Asteroid_field.field_asteroid_type.push_back("Orange");
}
Asteroid_field.field_asteroid_type = std::move(asteroid_types);

Asteroid_field.min_bound = o_min;
Asteroid_field.max_bound = o_max;
Expand All @@ -766,8 +758,6 @@ void asteroid_create_asteroid_field(int num_asteroids, int field_type, int aster
Asteroid_field.inner_max_bound = i_max;
}

Asteroid_field.target_names = std::move(targets);

// Only create asteroids if we have some to create
if ((!Asteroid_field.field_asteroid_type.empty()) && (num_asteroids > 0)) {
asteroid_create_all();
Expand Down
2 changes: 1 addition & 1 deletion code/asteroid/asteroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ bool asteroid_is_within_view(vec3d *pos, float range, bool range_override = f
void asteroid_level_init();
void asteroid_level_close();
void asteroid_create_all();
void asteroid_create_asteroid_field(int num_asteroids, int field_type, int asteroid_speed, bool brown, bool blue, bool orange, vec3d o_min, vec3d o_max, bool inner_box, vec3d i_min, vec3d i_max, SCP_vector<SCP_string> targets);
void asteroid_create_asteroid_field(int num_asteroids, int field_type, int asteroid_speed, vec3d o_min, vec3d o_max, bool inner_box, vec3d i_min, vec3d i_max, SCP_vector<SCP_string> asteroid_types);
void asteroid_create_debris_field(int num_asteroids, int asteroid_speed, SCP_vector<int> debris_types, vec3d o_min, vec3d o_max, bool enhanced);
void asteroid_render(object* obj, model_draw_list* scene);
void asteroid_delete( object *asteroid_objp );
Expand Down
Loading

0 comments on commit d68b18d

Please sign in to comment.