Resets all the properties a player ship to the default values Pass into inven_reset what you want passed to Inventory.Reset()
| 1485 | // Resets all the properties a player ship to the default values |
| 1486 | // Pass into inven_reset what you want passed to Inventory.Reset() |
| 1487 | void InitPlayerNewShip(int slot, int inven_reset) { |
| 1488 | int i; |
| 1489 | |
| 1490 | ASSERT(slot >= 0 && slot < MAX_PLAYERS); |
| 1491 | |
| 1492 | Players[slot].energy = INITIAL_ENERGY; |
| 1493 | Players[slot].num_balls = 0; |
| 1494 | Players[slot].laser_level = 0; |
| 1495 | Players[slot].killer_objnum = -1; |
| 1496 | Players[slot].light_dist = 0; |
| 1497 | Players[slot].oldroom = -1; |
| 1498 | Players[slot].guided_obj = NULL; |
| 1499 | Players[slot].user_timeout_obj = NULL; |
| 1500 | Players[slot].afterburn_time_left = AFTERBURN_TIME; |
| 1501 | Players[slot].last_thrust_time = 0; |
| 1502 | Players[slot].last_afterburner_time = 0; |
| 1503 | |
| 1504 | // start out with basic weapons |
| 1505 | for (i = 0; i < MAX_PLAYER_WEAPONS; i++) |
| 1506 | Players[slot].weapon_ammo[i] = 0; |
| 1507 | |
| 1508 | Players[slot].weapon_flags = HAS_FLAG(LASER_INDEX); |
| 1509 | Players[slot].weapon_flags += HAS_FLAG(CONCUSSION_INDEX); |
| 1510 | Players[slot].weapon_flags += HAS_FLAG(FLARE_INDEX); |
| 1511 | Players[slot].weapon_ammo[CONCUSSION_INDEX] = 2 + MAX_DIFFICULTY_LEVELS - Difficulty_level; |
| 1512 | |
| 1513 | Players[slot].weapon[PW_PRIMARY].index = LASER_INDEX; |
| 1514 | Players[slot].weapon[PW_PRIMARY].firing_time = 0; |
| 1515 | Players[slot].weapon[PW_PRIMARY].sound_handle = -1; |
| 1516 | |
| 1517 | Players[slot].weapon[PW_SECONDARY].index = CONCUSSION_INDEX; |
| 1518 | Players[slot].weapon[PW_SECONDARY].firing_time = 0; |
| 1519 | Players[slot].weapon[PW_SECONDARY].sound_handle = -1; |
| 1520 | |
| 1521 | Players[slot].small_left_obj = -1; |
| 1522 | Players[slot].small_right_obj = -1; |
| 1523 | Players[slot].small_dll_obj = -1; |
| 1524 | |
| 1525 | // some other stuff |
| 1526 | Players[slot].flags = 0; |
| 1527 | |
| 1528 | Players[slot].invulnerable_time = 0; |
| 1529 | |
| 1530 | Players[slot].damage_magnitude = 0; |
| 1531 | Players[slot].edrain_magnitude = 0; |
| 1532 | |
| 1533 | if (Players[slot].objnum >= 0 && Players[slot].objnum <= Highest_object_index && |
| 1534 | Objects[Players[slot].objnum].type != OBJ_NONE) |
| 1535 | Objects[Players[slot].objnum].weapon_fire_flags = 0; |
| 1536 | |
| 1537 | // reset the inventory |
| 1538 | Players[slot].inventory.Reset(true, inven_reset); |
| 1539 | Players[slot].counter_measures.Reset(true, inven_reset); |
| 1540 | |
| 1541 | Players[slot].last_homing_warning_sound_time = 0.0f; |
| 1542 | Players[slot].last_hit_wall_sound_time = 0.0f; |
| 1543 | Players[slot].multiplayer_flags = 0; |
| 1544 | Players[slot].last_multiplayer_flags = 0; |
no test coverage detected