Boost and speed limit tweaks.

This commit is contained in:
Steve 2015-11-15 23:23:03 +00:00
parent fabb57d7c2
commit cca3dedf7a
3 changed files with 26 additions and 8 deletions

View File

@ -355,7 +355,7 @@ void applyFighterThrust(void)
self->dy += -cos(TO_RAIDANS(self->angle)) * 0.1;
self->thrust = sqrt((self->dx * self->dx) + (self->dy * self->dy));
while (self->thrust > self->speed * self->speed)
if (self->thrust > self->speed * self->speed)
{
v = (self->speed / sqrt(self->thrust));
self->dx = v * self->dx;

View File

@ -26,6 +26,7 @@ static void selectMissionTarget(void);
static void selectNewPlayer(int dir);
static void initPlayerSelect(void);
static void activateBoost(void);
static void deactivateBoost(void);
static void activateECM(void);
static int selectedPlayerIndex;
@ -68,11 +69,6 @@ void doPlayer(void)
battle.boostTimer = MIN(battle.boostTimer + 1, BOOST_RECHARGE_TIME);
battle.ecmTimer = MIN(battle.ecmTimer + 1, ECM_RECHARGE_TIME);
if (battle.boostTimer == (int)BOOST_FINISHED_TIME)
{
applyFighterThrust();
}
if (player != NULL)
{
self = player;
@ -164,6 +160,11 @@ void doPlayer(void)
}
}
}
if (battle.boostTimer == (int)BOOST_FINISHED_TIME)
{
deactivateBoost();
}
}
void initPlayerSelect(void)
@ -247,6 +248,23 @@ static void activateBoost(void)
battle.boostTimer = 0;
}
static void deactivateBoost(void)
{
float v, thrust;
thrust = -1;
while (thrust != self->thrust)
{
thrust = self->thrust;
v = (self->speed / sqrt(self->thrust));
self->dx = v * self->dx;
self->dy = v * self->dy;
self->thrust = sqrt((self->dx * self->dx) + (self->dy * self->dy));
}
}
static void activateECM(void)
{
battle.ecmTimer = 0;

View File

@ -75,9 +75,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EF_ALWAYS_FLEES (2 << 9)
/* player abilities */
#define BOOST_RECHARGE_TIME (FPS * 5)
#define BOOST_RECHARGE_TIME (FPS * 7)
#define BOOST_FINISHED_TIME (FPS * 0.75)
#define ECM_RECHARGE_TIME (FPS * 5)
#define ECM_RECHARGE_TIME (FPS * 7)
enum
{