Skip to content

Commit b19c3e5

Browse files
fix more particle issues with standalone (#6886)
1 parent ffcf078 commit b19c3e5

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

code/asteroid/asteroid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, f
17501750
weapon_info *wip;
17511751
wip = &Weapon_info[Weapons[other_obj->instance].weapon_info_index];
17521752
// If the weapon didn't play any impact animation, play custom asteroid impact animation
1753-
if (!wip->impact_weapon_expl_effect.isValid()) {
1753+
if (!wip->impact_weapon_expl_effect.isValid() && Asteroid_impact_explosion_ani.isValid()) {
17541754
auto source = particle::ParticleManager::get()->createSource(Asteroid_impact_explosion_ani);
17551755
source->setHost(std::make_unique<EffectHostVector>(*hitpos, vmd_identity_matrix, vmd_zero_vector));
17561756
source->finishCreation();

code/scripting/api/libs/graphics.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,10 @@ static int spawnParticles(lua_State *L, bool persistent) {
22552255
// Need to consume tracer_length parameter but it isn't used anymore
22562256
float temp;
22572257

2258+
if (Is_standalone) {
2259+
return persistent ? ADE_RETURN_NIL : ADE_RETURN_FALSE;
2260+
}
2261+
22582262
enum_h* type = nullptr;
22592263
bool rev = false;
22602264
object_h* objh = nullptr;

code/ship/ship.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,6 +2449,11 @@ static ::util::UniformRange<T_range> parse_ship_particle_random_range(const char
24492449

24502450
particle::ParticleEffectHandle create_ship_legacy_particle_effect(LegacyShipParticleType type, float range, int bitmap, ::util::UniformFloatRange particle_num, ::util::UniformFloatRange radius, ::util::UniformFloatRange lifetime, ::util::UniformFloatRange velocity, float normal_variance, bool useNormal, float velocityInherit)
24512451
{
2452+
// this is always invalid on standalone so just bail early
2453+
if (Is_standalone) {
2454+
return particle::ParticleEffectHandle::invalid();
2455+
}
2456+
24522457
//Unfortunately legacy ship effects did a lot of ad-hoc computation of effect parameters.
24532458
//To mimic this in the modern system, these ad-hoc parameters are represented as hard-coded modular curves applied to various parts of the effect
24542459
std::optional<modular_curves_entry> part_number_curve, lifetime_curve, radius_curve, velocity_curve;

code/ship/shipfx.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,13 @@ static void maybe_fireball_wipe(clip_ship* half_ship, sound_handle* handle_array
18441844
if ( timestamp_elapsed(half_ship->next_fireball) ) {
18451845
if ( half_ship->length_left > 0.2f*fl_abs(half_ship->explosion_vel) ) {
18461846
ship_info *sip = &Ship_info[Ships[half_ship->parent_obj->instance].ship_info_index];
1847-
1847+
1848+
if ( !sip->split_particles.isValid() ) {
1849+
// time out forever
1850+
half_ship->next_fireball = timestamp(-1);
1851+
return;
1852+
}
1853+
18481854
polymodel* pm = model_get(sip->model_num);
18491855

18501856
vec3d model_clip_plane_pt, orig_ship_world_center, temp;

0 commit comments

Comments
 (0)