MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / EmitModelDestructionEffects

Method EmitModelDestructionEffects

PanzerChasm/server/map.cpp:3229–3254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3227}
3228
3229void Map::EmitModelDestructionEffects( const unsigned int model_number )
3230{
3231 PC_ASSERT( model_number < static_models_.size() );
3232 const StaticModel& model= static_models_[ model_number ];
3233
3234 if( model.model_id >= map_data_->models_description.size() )
3235 return;
3236
3237 const MapData::ModelDescription& description= map_data_->models_description[ model.model_id ];
3238 const Model& model_data= map_data_->models[ model.model_id ];
3239
3240 const unsigned int blow_effect_id= description.blow_effect % 100u;
3241
3242 m_Vec3 pos= model.pos;
3243 // TODO - tune this formula. It can be invalid.
3244 pos.z+= ( model_data.z_min + model_data.z_max ) * 0.5f + float( description.bmpz ) / 128.0f;
3245
3246 particles_effects_messages_.emplace_back();
3247 Messages::ParticleEffectBirth& message= particles_effects_messages_.back();
3248
3249 PositionToMessagePosition( pos, message.xyz );
3250 message.effect_id= static_cast<unsigned char>( ParticleEffect::FirstBlowEffect ) + blow_effect_id;
3251
3252 if( description.break_sfx_number != 0 )
3253 PlayMapEventSound( pos, description.break_sfx_number );
3254}
3255
3256void Map::GenParticleEffectForRocketHit( const m_Vec3& pos, const unsigned int rocket_type_id )
3257{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected