Boost and speed limit tweaks.
This commit is contained in:
parent
fabb57d7c2
commit
cca3dedf7a
|
@ -355,7 +355,7 @@ void applyFighterThrust(void)
|
||||||
self->dy += -cos(TO_RAIDANS(self->angle)) * 0.1;
|
self->dy += -cos(TO_RAIDANS(self->angle)) * 0.1;
|
||||||
self->thrust = sqrt((self->dx * self->dx) + (self->dy * self->dy));
|
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));
|
v = (self->speed / sqrt(self->thrust));
|
||||||
self->dx = v * self->dx;
|
self->dx = v * self->dx;
|
||||||
|
|
|
@ -26,6 +26,7 @@ static void selectMissionTarget(void);
|
||||||
static void selectNewPlayer(int dir);
|
static void selectNewPlayer(int dir);
|
||||||
static void initPlayerSelect(void);
|
static void initPlayerSelect(void);
|
||||||
static void activateBoost(void);
|
static void activateBoost(void);
|
||||||
|
static void deactivateBoost(void);
|
||||||
static void activateECM(void);
|
static void activateECM(void);
|
||||||
|
|
||||||
static int selectedPlayerIndex;
|
static int selectedPlayerIndex;
|
||||||
|
@ -68,11 +69,6 @@ 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);
|
||||||
|
|
||||||
if (battle.boostTimer == (int)BOOST_FINISHED_TIME)
|
|
||||||
{
|
|
||||||
applyFighterThrust();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player != NULL)
|
if (player != NULL)
|
||||||
{
|
{
|
||||||
self = player;
|
self = player;
|
||||||
|
@ -164,6 +160,11 @@ void doPlayer(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (battle.boostTimer == (int)BOOST_FINISHED_TIME)
|
||||||
|
{
|
||||||
|
deactivateBoost();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initPlayerSelect(void)
|
void initPlayerSelect(void)
|
||||||
|
@ -247,6 +248,23 @@ static void activateBoost(void)
|
||||||
battle.boostTimer = 0;
|
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)
|
static void activateECM(void)
|
||||||
{
|
{
|
||||||
battle.ecmTimer = 0;
|
battle.ecmTimer = 0;
|
||||||
|
|
|
@ -75,9 +75,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define EF_ALWAYS_FLEES (2 << 9)
|
#define EF_ALWAYS_FLEES (2 << 9)
|
||||||
|
|
||||||
/* player abilities */
|
/* player abilities */
|
||||||
#define BOOST_RECHARGE_TIME (FPS * 5)
|
#define BOOST_RECHARGE_TIME (FPS * 7)
|
||||||
#define BOOST_FINISHED_TIME (FPS * 0.75)
|
#define BOOST_FINISHED_TIME (FPS * 0.75)
|
||||||
#define ECM_RECHARGE_TIME (FPS * 5)
|
#define ECM_RECHARGE_TIME (FPS * 7)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue