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

Method MapState

PanzerChasm/client/map_state.cpp:12–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11
12MapState::MapState(
13 const MapDataConstPtr& map,
14 const GameResourcesConstPtr& game_resources,
15 const Time map_start_time )
16 : map_data_(map)
17 , game_resources_(game_resources)
18 , map_start_time_(map_start_time)
19 , last_tick_time_(map_start_time)
20{
21 PC_ASSERT( map_data_ != nullptr );
22
23 dynamic_walls_.resize( map_data_->dynamic_walls.size() );
24
25 for( unsigned int w= 0u; w < dynamic_walls_.size(); w++ )
26 {
27 const MapData::Wall& in_wall= map_data_->dynamic_walls[w];
28 DynamicWall& out_wall= dynamic_walls_[w];
29
30 out_wall.vert_pos[0]= in_wall.vert_pos[0];
31 out_wall.vert_pos[1]= in_wall.vert_pos[1];
32 out_wall.z= 0.0f;
33 out_wall.texture_id= in_wall.texture_id;
34 }
35
36 static_models_.resize( map_data_->static_models.size() );
37 for( unsigned int m= 0u; m < static_models_.size(); m++ )
38 {
39 const MapData::StaticModel& in_model= map_data_->static_models[m];
40 StaticModel& out_model= static_models_[m];
41
42 out_model.pos= m_Vec3( in_model.pos, 0.0f );
43 out_model.angle= in_model.angle;
44 out_model.model_id= in_model.model_id;
45 out_model.animation_frame= 0u;
46 out_model.visible= true;
47 }
48
49 items_.resize( map_data_->items.size() );
50 for( unsigned int i= 0u; i < items_.size(); i++ )
51 {
52 const MapData::Item& in_item= map_data_->items[i];
53 Item& out_item= items_[i];
54
55 out_item.pos= m_Vec3( in_item.pos, 0.0f );
56 out_item.angle= in_item.angle;
57 out_item.item_id= in_item.item_id;
58 out_item.picked_up= false;
59 out_item.animation_frame= 0;
60 }
61}
62
63MapState::~MapState()
64{}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected