From 6dcbd265d98f6e74f0524b7562200ed59c286403 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 10 May 2016 10:03:17 +0100 Subject: [PATCH] Restrict controls when player is dead or disabled. --- src/battle/player.c | 89 ++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/src/battle/player.c b/src/battle/player.c index ada6069..a210789 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -93,66 +93,63 @@ void doPlayer(void) battle.boostTimer = MIN(battle.boostTimer + 1, BOOST_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) { - 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) { - applyRestrictions(); - } - - 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) + if (!game.currentMission->challengeData.allowPlayerDeath) { failMission(); } - else if (player->health == -FPS) - { - initPlayerSelect(); - } } - - if (battle.status == MS_IN_PROGRESS) + else if (!battle.isEpic) { - selectMissionTarget(); + failMission(); } - - if (dev.playerUnlimitedMissiles) + else if (player->health == -FPS) { - player->missiles = 999; + initPlayerSelect(); } } + + if (battle.status == MS_IN_PROGRESS) + { + selectMissionTarget(); + } + + if (dev.playerUnlimitedMissiles) + { + player->missiles = 999; + } /* really only used in challenge mode */ if (player->systemPower <= 0 && battle.status == MS_IN_PROGRESS)