MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / handlePlayerDying

Function handlePlayerDying

TheForceEngine/TFE_DarkForces/player.cpp:1592–1650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1590 }
1591
1592 void handlePlayerDying()
1593 {
1594 s_minEyeDistFromFloor = ONE_16;
1595 s_playerCrouchSpd = 0x5b332; // 5.7
1596 s_playerPitch += mul16(0x6aa, s_deltaTime);
1597 s_playerRoll -= mul16(0xd55, s_deltaTime);
1598
1599 s_playerPitch = clamp(s_playerPitch, -1023, 1023);
1600 s_playerRoll = clamp(s_playerRoll, -1592, 1592);
1601
1602 s_playerSecFire = JFALSE;
1603 s_playerPrimaryFire = JFALSE;
1604
1605 if (inputMapping_getActionState(IADF_JUMP) || inputMapping_getActionState(IADF_MENU_TOGGLE) || inputMapping_getActionState(IADF_USE))
1606 {
1607 inputMapping_removeState(IADF_JUMP);
1608 inputMapping_removeState(IADF_MENU_TOGGLE);
1609 inputMapping_removeState(IADF_USE);
1610
1611 if (s_lifeCount != 0 && s_curSafe)
1612 {
1613 s_lifeCount -= 1;
1614 player_revive();
1615 player_reset();
1616 s_headlampActive = JFALSE;
1617 s_nightVisionActive = JFALSE;
1618 disableNightVisionInternal();
1619
1620 s_playerObject->yaw = s_curSafe->yaw;
1621 s_playerYaw = s_curSafe->yaw;
1622 s_playerObject->posWS.x = s_curSafe->x;
1623 s_playerObject->posWS.z = s_curSafe->z;
1624
1625 RSector* sector = s_curSafe->sector;
1626 fixed16_16 floorHeight = sector->floorHeight + sector->secHeight;
1627 s_playerObject->posWS.y = floorHeight;
1628 s_playerYPos = s_playerObject->posWS.y;
1629 player_changeSector(sector);
1630
1631 s_nextShieldDmgTick = s_curTick + 436;
1632 if (s_invincibilityTask)
1633 {
1634 task_free(s_invincibilityTask);
1635 }
1636 s_invincibilityTask = nullptr;
1637 s_invincibility = 0;
1638 s_flyMode = JFALSE;
1639 s_noclip = JFALSE;
1640 player_clearSuperCharge();
1641 }
1642 else
1643 {
1644 player_revive();
1645 player_reset();
1646 s_levelComplete = JFALSE;
1647 mission_exitLevel();
1648 }
1649 }

Callers 1

playerControlTaskFuncFunction · 0.85

Calls 11

mul16Function · 0.85
clampFunction · 0.85
inputMapping_removeStateFunction · 0.85
player_reviveFunction · 0.85
player_resetFunction · 0.85
player_changeSectorFunction · 0.85
task_freeFunction · 0.85
player_clearSuperChargeFunction · 0.85
mission_exitLevelFunction · 0.85

Tested by

no test coverage detected