| 424 | } |
| 425 | |
| 426 | void initializeNewNpcEntity(const GameDataStore &data, Entity &e, const Parse_NPC *src, int idx, int variant) |
| 427 | { |
| 428 | e.m_costume_type = AppearanceType::NpcCostume; |
| 429 | e.m_destroyed = false; |
| 430 | e.m_type = EntType::NPC; // 2 |
| 431 | e.m_create_player = false; |
| 432 | e.m_is_hero = false; |
| 433 | e.m_is_villain = false; // only Critters are Villains |
| 434 | e.m_entity_data.m_origin_idx = {0}; |
| 435 | e.m_entity_data.m_class_idx = getEntityClassIndex(data,false,src->m_Class); |
| 436 | e.m_hasname = true; |
| 437 | e.m_has_supergroup = false; |
| 438 | e.m_has_team = false; |
| 439 | e.m_pchar_things = false; |
| 440 | e.m_faction_data.m_has_faction = true; |
| 441 | e.m_faction_data.m_rank = src->m_Rank; |
| 442 | e.m_target_idx = 0; |
| 443 | e.m_assist_target_idx = 0; |
| 444 | e.m_move_type = MoveType::MOVETYPE_WALK; |
| 445 | e.m_motion_state.m_is_falling = true; |
| 446 | |
| 447 | e.m_char = std::make_unique<Character>(); |
| 448 | e.m_npc = std::make_unique<NPCData>(NPCData{false,src,idx,variant}); |
| 449 | e.m_player.reset(); |
| 450 | e.m_entity = std::make_unique<EntityData>(); |
| 451 | e.m_update_anims = e.m_rare_update = true; |
| 452 | e.m_char->m_char_data.m_level = src->m_Level; |
| 453 | |
| 454 | std::copy(g_world_surf_params, g_world_surf_params+2, e.m_motion_state.m_surf_mods); |
| 455 | |
| 456 | e.m_states.init(); // Initialize movement input state pointers |
| 457 | e.m_states.current()->m_pos_start = e.m_states.current()->m_pos_end = e.m_entity_data.m_pos; |
| 458 | |
| 459 | PosUpdate p; |
| 460 | for(int i = 0; i<64; i++) |
| 461 | { |
| 462 | // Get timestamp in ms |
| 463 | auto now_ms = std::chrono::steady_clock::now().time_since_epoch().count(); |
| 464 | |
| 465 | p.m_position = e.m_entity_data.m_pos; |
| 466 | p.m_pyr_angles = e.m_entity_data.m_orientation_pyr; |
| 467 | p.m_timestamp = now_ms; |
| 468 | addPosUpdate(e, p); |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | void initializeNewCritterEntity(const GameDataStore &data, Entity &e, const Parse_NPC *src, int idx, int variant, int level) |
| 473 | { |
no test coverage detected