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

Method ProcessDeathZone

PanzerChasm/server/map.cpp:2539–2564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2537}
2538
2539void Map::ProcessDeathZone( const MapData::Procedure::ActionCommand& command, const bool activate )
2540{
2541 PC_ASSERT( command.id == MapData::Procedure::ActionCommandId::Death );
2542
2543 const unsigned int x0= static_cast<unsigned int>( command.args[0] );
2544 const unsigned int y0= static_cast<unsigned int>( command.args[1] );
2545 const unsigned int x1= static_cast<unsigned int>( command.args[2] );
2546 const unsigned int y1= static_cast<unsigned int>( command.args[3] );
2547 const int z_0= static_cast<int>( command.args[4] );
2548 const int z_1= static_cast<int>( command.args[5] );
2549 const unsigned char damage= static_cast<unsigned char>( command.args[6] );
2550
2551 for( unsigned int y= y0; y <= y1 && y < MapData::c_map_size; y++ )
2552 for( unsigned int x= x0; x <= x1 && x < MapData::c_map_size; x++ )
2553 {
2554 DamageFiledCell& cell= death_field_[ x + y * MapData::c_map_size ];
2555 if( activate )
2556 {
2557 cell.damage= damage;
2558 cell.z_bottom= std::max( std::min( z_0, 255 ), 0 );
2559 cell.z_top = std::max( std::min( z_1, 255 ), 0 );
2560 }
2561 else
2562 cell.damage= 0u;
2563 }
2564}
2565
2566void Map::DestroyModel( const unsigned int model_index )
2567{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected