Restrict controls when player is dead or disabled.

This commit is contained in:
Steve 2016-05-10 10:03:17 +01:00
parent 09ecd97f29
commit 6dcbd265d9
1 changed files with 43 additions and 46 deletions

View File

@ -93,66 +93,63 @@ void doPlayer(void)
battle.boostTimer = MIN(battle.boostTimer + 1, BOOST_RECHARGE_TIME); battle.boostTimer = MIN(battle.boostTimer + 1, BOOST_RECHARGE_TIME);
battle.ecmTimer = MIN(battle.ecmTimer + 1, ECM_RECHARGE_TIME); battle.ecmTimer = MIN(battle.ecmTimer + 1, ECM_RECHARGE_TIME);
self = player;
if (game.currentMission->challengeData.isChallenge)
{
applyRestrictions();
}
if (player->alive == ALIVE_ALIVE && player->systemPower > 0) if (player->alive == ALIVE_ALIVE && player->systemPower > 0)
{ {
self = player; handleKeyboard();
handleMouse();
if (!player->target || player->target->health <= 0 || player->target->systemPower <= 0 || targetOutOfRange())
{
selectTarget();
}
}
player->angle = ((int)player->angle) % 360;
if (player->health <= 0 && battle.status == MS_IN_PROGRESS)
{
battle.stats[STAT_PLAYER_KILLED]++;
/* the player is known as "Player", so we need to check the craft they were assigned to */
if (strcmp(game.currentMission->craft, "ATAF") == 0)
{
awardTrophy("ATAF_DESTROYED");
}
if (game.currentMission->challengeData.isChallenge) if (game.currentMission->challengeData.isChallenge)
{ {
applyRestrictions(); if (!game.currentMission->challengeData.allowPlayerDeath)
}
if (player->alive == ALIVE_ALIVE)
{
handleKeyboard();
handleMouse();
if (!player->target || player->target->health <= 0 || player->target->systemPower <= 0 || targetOutOfRange())
{
selectTarget();
}
}
player->angle = ((int)player->angle) % 360;
if (player->health <= 0 && battle.status == MS_IN_PROGRESS)
{
battle.stats[STAT_PLAYER_KILLED]++;
/* the player is known as "Player", so we need to check the craft they were assigned to */
if (strcmp(game.currentMission->craft, "ATAF") == 0)
{
awardTrophy("ATAF_DESTROYED");
}
if (game.currentMission->challengeData.isChallenge)
{
if (!game.currentMission->challengeData.allowPlayerDeath)
{
failMission();
}
}
else if (!battle.isEpic)
{ {
failMission(); failMission();
} }
else if (player->health == -FPS)
{
initPlayerSelect();
}
} }
else if (!battle.isEpic)
if (battle.status == MS_IN_PROGRESS)
{ {
selectMissionTarget(); failMission();
} }
else if (player->health == -FPS)
if (dev.playerUnlimitedMissiles)
{ {
player->missiles = 999; initPlayerSelect();
} }
} }
if (battle.status == MS_IN_PROGRESS)
{
selectMissionTarget();
}
if (dev.playerUnlimitedMissiles)
{
player->missiles = 999;
}
/* really only used in challenge mode */ /* really only used in challenge mode */
if (player->systemPower <= 0 && battle.status == MS_IN_PROGRESS) if (player->systemPower <= 0 && battle.status == MS_IN_PROGRESS)