Reduce mission list font size a little, to fit all missions in. Highlight mission on hover.
This commit is contained in:
parent
2ad4de22bf
commit
052f39fbad
|
@ -67,6 +67,7 @@ static int scrollingMap;
|
||||||
static int campaignComplete = 0;
|
static int campaignComplete = 0;
|
||||||
static PointF cameraMin, cameraMax;
|
static PointF cameraMin, cameraMax;
|
||||||
static Widget *startMissionButton;
|
static Widget *startMissionButton;
|
||||||
|
static Mission *hoverMission;
|
||||||
static char *MISSIONS_TEXT;
|
static char *MISSIONS_TEXT;
|
||||||
static char *PILOT_TEXT;
|
static char *PILOT_TEXT;
|
||||||
static char *CRAFT_TEXT;
|
static char *CRAFT_TEXT;
|
||||||
|
@ -115,6 +116,8 @@ void initGalacticMap(void)
|
||||||
|
|
||||||
updateCampaignProgress();
|
updateCampaignProgress();
|
||||||
|
|
||||||
|
hoverMission = NULL;
|
||||||
|
|
||||||
app.saveGame = 1;
|
app.saveGame = 1;
|
||||||
|
|
||||||
pulseTimer = 0;
|
pulseTimer = 0;
|
||||||
|
@ -321,15 +324,20 @@ static void doStarSystemView(void)
|
||||||
|
|
||||||
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||||
{
|
{
|
||||||
if (mission->available && app.mouse.button[SDL_BUTTON_LEFT] && collision(app.mouse.x - app.mouse.w / 2, app.mouse.y - app.mouse.h / 2, app.mouse.w, app.mouse.h, mission->rect.x, mission->rect.y, mission->rect.w, mission->rect.h))
|
if (mission->available && collision(app.mouse.x - app.mouse.w / 2, app.mouse.y - app.mouse.h / 2, app.mouse.w, app.mouse.h, mission->rect.x, mission->rect.y, mission->rect.w, mission->rect.h))
|
||||||
{
|
{
|
||||||
if (game.currentMission != mission)
|
hoverMission = mission;
|
||||||
{
|
|
||||||
playSound(SND_GUI_CLICK);
|
|
||||||
}
|
|
||||||
|
|
||||||
game.currentMission = mission;
|
if (app.mouse.button[SDL_BUTTON_LEFT])
|
||||||
return;
|
{
|
||||||
|
if (game.currentMission != mission)
|
||||||
|
{
|
||||||
|
playSound(SND_GUI_CLICK);
|
||||||
|
}
|
||||||
|
|
||||||
|
game.currentMission = mission;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +627,7 @@ static Mission *nextAvailableMission(StarSystem *starSystem)
|
||||||
|
|
||||||
static void drawStarSystemDetail(void)
|
static void drawStarSystemDetail(void)
|
||||||
{
|
{
|
||||||
int y, start, i;
|
int y;
|
||||||
Mission *mission;
|
Mission *mission;
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
|
@ -647,41 +655,37 @@ static void drawStarSystemDetail(void)
|
||||||
|
|
||||||
y += 80;
|
y += 80;
|
||||||
|
|
||||||
/*
|
|
||||||
* this only really counts for Alba, as it has 10 missions and there's only space for 9 to display.
|
|
||||||
* We need to subtract 1 from the completed missions to get the correct number (mission at the bottom will be the one to select).
|
|
||||||
*/
|
|
||||||
start = MAX(selectedStarSystem->availableMissions - MAX_LISTED_MISSIONS, 0);
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||||
{
|
{
|
||||||
if (i >= start)
|
mission->rect.x = 200;
|
||||||
|
mission->rect.y = y - 2;
|
||||||
|
mission->rect.w = 300;
|
||||||
|
mission->rect.h = 38;
|
||||||
|
|
||||||
|
if (mission == hoverMission)
|
||||||
{
|
{
|
||||||
mission->rect.x = 200;
|
SDL_SetRenderDrawColor(app.renderer, 16, 32, 64, 255);
|
||||||
mission->rect.y = y - 2;
|
SDL_RenderFillRect(app.renderer, &mission->rect);
|
||||||
mission->rect.w = 300;
|
|
||||||
mission->rect.h = 40;
|
|
||||||
|
|
||||||
if (mission == game.currentMission)
|
SDL_SetRenderDrawColor(app.renderer, 32, 64, 128, 255);
|
||||||
{
|
SDL_RenderDrawRect(app.renderer, &mission->rect);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 32, 64, 128, 255);
|
|
||||||
SDL_RenderFillRect(app.renderer, &mission->rect);
|
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 64, 96, 196, 255);
|
|
||||||
SDL_RenderDrawRect(app.renderer, &mission->rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mission->available)
|
|
||||||
{
|
|
||||||
drawText(210, y, 24, TA_LEFT, mission->completed ? colors.lightGrey : colors.yellow, mission->name);
|
|
||||||
|
|
||||||
y += 50;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
if (mission == game.currentMission)
|
||||||
|
{
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 32, 64, 128, 255);
|
||||||
|
SDL_RenderFillRect(app.renderer, &mission->rect);
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 64, 96, 196, 255);
|
||||||
|
SDL_RenderDrawRect(app.renderer, &mission->rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mission->available)
|
||||||
|
{
|
||||||
|
drawText(210, y, 22, TA_LEFT, mission->completed ? colors.lightGrey : colors.yellow, mission->name);
|
||||||
|
|
||||||
|
y += 42;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.currentMission->available)
|
if (game.currentMission->available)
|
||||||
|
|
Loading…
Reference in New Issue