| 166 | } |
| 167 | |
| 168 | CSE_Abstract* CLevel::spawn_item(LPCSTR section, const Fvector& position, u32 level_vertex_id, u16 parent_id, bool return_item) |
| 169 | { |
| 170 | CSE_Abstract* abstract = F_entity_Create(section); |
| 171 | R_ASSERT3(abstract, "Cannot find item with section", section); |
| 172 | CSE_ALifeDynamicObject* dynamic_object = smart_cast<CSE_ALifeDynamicObject*>(abstract); |
| 173 | if (dynamic_object && ai().get_level_graph()) |
| 174 | { |
| 175 | dynamic_object->m_tNodeID = level_vertex_id; |
| 176 | if (ai().level_graph().valid_vertex_id(level_vertex_id) && ai().get_game_graph() && ai().get_cross_table()) |
| 177 | dynamic_object->m_tGraphID = ai().cross_table().vertex(level_vertex_id).game_vertex_id(); |
| 178 | } |
| 179 | |
| 180 | //оружие спавним с полным магазинои |
| 181 | CSE_ALifeItemWeapon* weapon = smart_cast<CSE_ALifeItemWeapon*>(abstract); |
| 182 | if (weapon) |
| 183 | weapon->a_elapsed = weapon->get_ammo_magsize(); |
| 184 | |
| 185 | // Fill |
| 186 | abstract->s_name = section; |
| 187 | abstract->set_name_replace(section); |
| 188 | abstract->s_gameid = u8(GameID()); |
| 189 | abstract->o_Position = position; |
| 190 | abstract->s_RP = 0xff; |
| 191 | abstract->ID = 0xffff; |
| 192 | abstract->ID_Parent = parent_id; |
| 193 | abstract->ID_Phantom = 0xffff; |
| 194 | abstract->s_flags.assign(M_SPAWN_OBJECT_LOCAL); |
| 195 | abstract->RespawnTime = 0; |
| 196 | |
| 197 | if (!return_item) |
| 198 | { |
| 199 | NET_Packet P; |
| 200 | abstract->Spawn_Write(P, TRUE); |
| 201 | Send(P, net_flags(TRUE)); |
| 202 | F_entity_Destroy(abstract); |
| 203 | return (0); |
| 204 | } |
| 205 | else |
| 206 | return (abstract); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | void CLevel::ProcessGameSpawns() |
no test coverage detected