Tell player to initially face mission target / enemies, so we're not always facing up the screen.
This commit is contained in:
parent
001e397335
commit
e15ebcba9b
|
@ -120,10 +120,10 @@ static void setPilotName(void)
|
||||||
|
|
||||||
void doPlayer(void)
|
void doPlayer(void)
|
||||||
{
|
{
|
||||||
rechargeBoostECM();
|
|
||||||
|
|
||||||
self = player;
|
self = player;
|
||||||
|
|
||||||
|
rechargeBoostECM();
|
||||||
|
|
||||||
if (game.currentMission->challengeData.isChallenge)
|
if (game.currentMission->challengeData.isChallenge)
|
||||||
{
|
{
|
||||||
applyRestrictions();
|
applyRestrictions();
|
||||||
|
@ -492,9 +492,9 @@ static void selectNewPlayer(int dir)
|
||||||
|
|
||||||
static void activateBoost(void)
|
static void activateBoost(void)
|
||||||
{
|
{
|
||||||
self->dx += sin(TO_RAIDANS(self->angle)) * 10;
|
player->dx += sin(TO_RAIDANS(player->angle)) * 10;
|
||||||
self->dy += -cos(TO_RAIDANS(self->angle)) * 10;
|
player->dy += -cos(TO_RAIDANS(player->angle)) * 10;
|
||||||
self->thrust = sqrt((self->dx * self->dx) + (self->dy * self->dy));
|
player->thrust = sqrt((player->dx * player->dx) + (player->dy * player->dy));
|
||||||
|
|
||||||
battle.boostTimer = 0;
|
battle.boostTimer = 0;
|
||||||
|
|
||||||
|
@ -507,14 +507,14 @@ static void deactivateBoost(void)
|
||||||
|
|
||||||
thrust = -1;
|
thrust = -1;
|
||||||
|
|
||||||
while (thrust != self->thrust)
|
while (thrust != player->thrust)
|
||||||
{
|
{
|
||||||
thrust = self->thrust;
|
thrust = player->thrust;
|
||||||
|
|
||||||
v = (self->speed / sqrt(self->thrust));
|
v = (player->speed / sqrt(player->thrust));
|
||||||
self->dx = v * self->dx;
|
player->dx = v * player->dx;
|
||||||
self->dy = v * self->dy;
|
player->dy = v * player->dy;
|
||||||
self->thrust = sqrt((self->dx * self->dx) + (self->dy * self->dy));
|
player->thrust = sqrt((player->dx * player->dx) + (player->dy * player->dy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +575,8 @@ static void selectTarget(void)
|
||||||
{
|
{
|
||||||
if (e->active && e != player && (e->flags & EF_TAKES_DAMAGE) && (!(e->flags & EF_NO_PLAYER_TARGET)) && e->side != player->side && e->alive == ALIVE_ALIVE && e->systemPower > 0 && i < MAX_SELECTABLE_TARGETS)
|
if (e->active && e != player && (e->flags & EF_TAKES_DAMAGE) && (!(e->flags & EF_NO_PLAYER_TARGET)) && e->side != player->side && e->alive == ALIVE_ALIVE && e->systemPower > 0 && i < MAX_SELECTABLE_TARGETS)
|
||||||
{
|
{
|
||||||
dist = getDistance(self->x, self->y, e->x, e->y);
|
dist = getDistance(player->x, player->y, e->x, e->y);
|
||||||
|
|
||||||
if (dist < closest)
|
if (dist < closest)
|
||||||
{
|
{
|
||||||
near = e;
|
near = e;
|
||||||
|
@ -629,7 +630,7 @@ static void selectMissionTarget(void)
|
||||||
{
|
{
|
||||||
if (e->active && e->flags & EF_MISSION_TARGET && e->alive == ALIVE_ALIVE)
|
if (e->active && e->flags & EF_MISSION_TARGET && e->alive == ALIVE_ALIVE)
|
||||||
{
|
{
|
||||||
dist = getDistance(self->x, self->y, e->x, e->y);
|
dist = getDistance(player->x, player->y, e->x, e->y);
|
||||||
|
|
||||||
if (battle.missionTarget == NULL)
|
if (battle.missionTarget == NULL)
|
||||||
{
|
{
|
||||||
|
@ -674,6 +675,42 @@ static int isPriorityMissionTarget(Entity *e, int dist, int closest)
|
||||||
return dist < closest;
|
return dist < closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setInitialPlayerAngle(void)
|
||||||
|
{
|
||||||
|
Entity *e;
|
||||||
|
|
||||||
|
selectMissionTarget();
|
||||||
|
|
||||||
|
if (battle.missionTarget)
|
||||||
|
{
|
||||||
|
player->angle = getAngle(player->x, player->y, battle.missionTarget->x, battle.missionTarget->y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectTarget();
|
||||||
|
|
||||||
|
if (player->target)
|
||||||
|
{
|
||||||
|
player->angle = getAngle(player->x, player->y, player->target->x, player->target->y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (battle.jumpgate)
|
||||||
|
{
|
||||||
|
player->angle = getAngle(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||||
|
{
|
||||||
|
if (e->side == player->side)
|
||||||
|
{
|
||||||
|
e->angle = player->angle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void cycleRadarZoom(void)
|
static void cycleRadarZoom(void)
|
||||||
{
|
{
|
||||||
battle.radarRange = (battle.radarRange + 1) % 3;
|
battle.radarRange = (battle.radarRange + 1) % 3;
|
||||||
|
|
|
@ -209,6 +209,8 @@ void loadMission(char *filename)
|
||||||
|
|
||||||
initMissionInfo();
|
initMissionInfo();
|
||||||
|
|
||||||
|
setInitialPlayerAngle();
|
||||||
|
|
||||||
addAllToQuadtree();
|
addAllToQuadtree();
|
||||||
|
|
||||||
playMusic(music, 1);
|
playMusic(music, 1);
|
||||||
|
|
|
@ -63,6 +63,7 @@ extern void activateNextWaypoint(void);
|
||||||
extern void awardStatsTrophies(void);
|
extern void awardStatsTrophies(void);
|
||||||
extern void awardPostMissionTrophies(void);
|
extern void awardPostMissionTrophies(void);
|
||||||
extern void awardCraftTrophy(void);
|
extern void awardCraftTrophy(void);
|
||||||
|
extern void setInitialPlayerAngle(void);
|
||||||
|
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
extern Dev dev;
|
extern Dev dev;
|
||||||
|
|
Loading…
Reference in New Issue